zteradb/zteradb-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zteradb/zteradb-php

最新稳定版本:v1.1.0

Composer 安装命令:

composer require zteradb/zteradb-php

包简介

ZTeraDB PHP client (ZQL, raw socket transport) - PHP 5.6+

README 文档

README

This is a PHP 5.6+ client library for interacting with ZTeraDB, a platform that allows you to connect to your existing databases and query them using ZTeraDB Query Language (ZQL). The client provides an easy-to-use interface to send queries to ZTeraDB and retrieve results in a standardized format.

This package implements a ZQL-first PHP client for ZTeraDB using a raw TCP socket transport. It assumes the server uses 4-byte big-endian length-prefixed payloads that contain JSON payloads.

Table of Contents

  1. Features
  2. Requirements
  3. Installing
  4. Usage
  5. Configuration
  6. ZTeraDB Connection
  7. Query
  8. Filter Conditions
  9. License

Features

  • Connect to Multiple Databases: Seamlessly interact with your existing databases through ZTeraDB.
  • ZTeraDB Query Language (ZQL): Use a unified query language to query data across different database systems.
  • Easy Integration: Easily integrate ZTeraDB into your Node.js application.
  • Asynchronous Queries: Support for async/await syntax to handle queries and results asynchronously.
  • Error Handling: Comprehensive error handling to help debug and manage database queries.

Requirements

  • This is a php5.6+ module available through the Packagist (packagist.org) registry.
  • Before installing, download and install php. PHP 5.6.40 or higher is required.

Install

Run following command to install the ZTeraDB client for php.

# Using composer
composer require zteradb/zteradb-php

OR

Install from the ZTeraDB github repository. Create a composor.json file with following content.

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/zteradb/zteradb-php"
    }
  ],
  "require": {
    "zteradb/zteradb-php": "v1.0"
  }
}

Install the ZTeraDB Client for php.

composer require zteradb/zteradb-php:v1.0

Usage

require_once "vendor/autoload.php";

use ZTeraDB\Config\Options;
use ZTeraDB\Config\ConnectionPool;
use ZTeraDB\Config\ENVS;
use ZTeraDB\Config\ResponseDataTypes;
use ZTeraDB\Config\ZTeraDBConfig;
use ZTeraDB\Connection\ZTeraDBConnection;
use ZTeraDB\Query\ZTeraDBQuery;

# ZTeraDB host, port details from environment.
$host = getenv("ZTERADB_HOST");
$port = (int) getenv('PORT');

# ZTeraDB configuration details
$zteradb_config = new ZTeraDBConfig([
        "client_key" => getenv("CLIENT_KEY"),
        "access_key" => getenv("ACCESS_KEY"),
        "secret_key" => getenv("SECRET_KEY"),
        "database_id" => getenv("DATABASE_ID"),
        "env" => ENVS::dev,
        "response_data_type" => ResponseDataTypes::json,
    ]);

# Connect to ZTeraDB server
$conn = new ZTeraDBConnection($host, $port, $zteradb_config);

# Schema name to get the result
$query = new ZTeraDBQuery("<your schema name>");

# Run the query
$rows = $conn->run($query);

# Iterate the query result
foreach($rows as $row) {
  print_r($row);
}

# Close all connections
$conn->close();

License

This project is licensed under the ZTeraDB License - see LICENCE file for details.

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2025-11-28