zteradb/zteradb-php
Composer 安装命令:
composer require zteradb/zteradb-php
包简介
High-performance async PHP client for ZTeraDB utilizing raw TCP socket transport layer.
README 文档
README
The official PHP client for ZTeraDB—a unified database abstraction platform. This library enables you to connect to your existing data infrastructure and execute queries seamlessly using ZTeraDB Query Language (ZQL).
Technical Overview
This package implements a performance-optimized, ZQL-first PHP client utilizing a raw TCP socket transport layer.
To ensure low-overhead binary framing, the client communicates with the ZTeraDB server using 4-byte big-endian length-prefixed payloads containing structured JSON data. This underlying transport architecture eliminates HTTP overhead, offering high-throughput query execution directly from your PHP runtime.
🧠 Architecture Overview
You never connect to your backend databases directly. ZTeraDB handles all connections, cryptographic signing, proxy routing, and query execution securely behind the scenes.
Your App ➔ ZTeraDB PHP Client ➔ ZTeraDB Server ➔ Your Databases
Key Features
- Unified Access: Query multiple existing databases through a single interface.
- Type-Safe & Standardized: Receive predictable, structured payloads regardless of the underlying data source.
- Lightweight: Built with minimal overhead, supporting modern PHP environments (7.2+).
Table of Contents
⭐ Key Features
- 🚀 Unified Query Language (ZQL): Write once, run on any database (PostgreSQL, MySQL, MSSQL, etc.).
- 🔌 Easy Integration: Seamlessly plugs into any PHP application or framework (Laravel, Symfony, CodeIgniter).
- ⚙️ Auto-Managed Connections: Handles connection pooling and automatic retries behind the scenes.
- 🔐 Secure Authentication: Protected via client, access, and secret keys with cryptographic signing.
- 🎯 Clean Query Builder: Fluent interface for standard CRUD operations (
insert,select,update,delete). - 🔍 Advanced Filtering: Built-in support for complex logical and mathematical filters.
- 🧵 Streamed Results: Efficiently memory-manages large datasets using PHP generators.
- 📦 Type-Safe & Standardized: Receive predictable, structured payloads regardless of the underlying data source.
🛠 Prerequisites & Requirements
| Requirement | Specification |
|---|---|
| PHP Version | PHP 7.2 or higher (Download from php.net) |
| Extensions | sockets extension must be enabled in your php.ini file |
| Package Registry | Available via Packagist |
Installation
Option 1: Via Composer (Recommended)
Run the following command in your terminal to install the ZTeraDB client:
# Using composer
composer require zteradb/zteradb-php
Option 2: From GitHub Repository
Alternatively, you can pull the package directly from GitHub. Add the repository to your composer.json file:
{
"repositories": [
{
"type": "vcs",
"url": "[https://github.com/zteradb/zteradb-php](https://github.com/zteradb/zteradb-php)"
}
],
"require": {
"zteradb/zteradb-php": "v1.0"
}
}
Then, run the installation command:
composer require zteradb/zteradb-php:v2.0.0
🚀 60-Second Quick Start
<?php require_once "vendor/autoload.php"; use ZTeraDB\Config\ZTeraDBConfig; use ZTeraDB\Connection\ZTeraDBConnection; use ZTeraDB\Query\ZTeraDBQuery; use ZTeraDB\Config\ResponseDataTypes; use ZTeraDB\Config\ENVS; // 1. Setup Configuration $config = new ZTeraDBConfig([ 'client_key' => getenv('ZTERADB_CLIENT_KEY'), 'access_key' => getenv('ZTERADB_ACCESS_KEY'), 'secret_key' => getenv('ZTERADB_SECRET_KEY'), 'database_id' => getenv('ZTERADB_DATABASE_ID'), 'env' => ENVS::dev, 'response_data_type' => ResponseDataTypes::json, ]); // 2. Initialize Connection $db = new ZTeraDBConnection( getenv("ZTERADB_HOST"), getenv("ZTERADB_PORT"), $config ); // 3. Build ZQL Query $query = (new ZTeraDBQuery("user"))->select(); // 4. Execute and Stream Results foreach ($db->run($query) as $row) { print_r($row); } // 5. Close Connection $db->close(); ?>
🗂 Documentation Sections
Explore the rest of our guides to unlock the full potential of ZTeraDB:
- Configuration - Learn all available configuration options.
- Connection - Deep dive into socket connections and lifecycle management.
- Query Builder - Master building fluent ZQL queries.
- Filter Conditions - Apply advanced math and logical filters to your data.
- Examples — Copy-pasteable snippets for common use cases.
- Troubleshooting Guide — How to resolve common connection or runtime errors.
- Quickstart Guide — A streamlined, 5-minute setup guide.
- Licence — Open-source licence terms.
Licence
This project is licenced under the ZTeraDB Licence - see LICENCE file for details.
zteradb/zteradb-php 适用场景与选型建议
zteradb/zteradb-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 18 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database」 「sockets」 「async」 「zteradb」 「zql」 「tcp-client」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 zteradb/zteradb-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 zteradb/zteradb-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 zteradb/zteradb-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
Store your language lines in the database, yaml or other sources
The bundle for easy using json-rpc api on your project
An async event for hyperf.
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Synchronous Message Passing Framework for PHP
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2025-11-28