Skip to main content

ZTeraDB Client Driver

Welcome!
This documentation will walk you through ZTeraDB step-by-step, using simple language and practical PHP examples.


๐Ÿ“˜ What Is ZTeraDB?

ZTeraDB helps you connect to your existing databases (PostgreSQL, MySQL, MSSQL, etc.) through a single unified platform.
You write one query language (ZQL) instead of switching between SQL dialects.


๐Ÿง  Architecture (Simple Explanation)

Your App โ†’ ZTeraDB PHP Client โ†’ ZTeraDB Server โ†’ Your Databases

You never connect to the database directly.
ZTeraDB handles all connections, routing, and execution securely behind the scenes.


โญ Features

  • ๐Ÿš€ Unified Query Language (ZQL)
  • ๐Ÿ”Œ Easy integration with any PHP application
  • โš™๏ธ Auto-managed connections & retries
  • ๐Ÿ” Secure authentication using client keys
  • ๐ŸŽฏ Clean query builder (insert, select, update, delete)
  • ๐Ÿ” Advanced logical & mathematical filters
  • ๐Ÿงต Streamed results for large datasets
  • ๐Ÿ“ฆ Composer-based installation
  • ๐Ÿงฉ Works with frameworks like Laravel, Symfony, CodeIgniter

๐Ÿ›  Requirements


๐Ÿ“ฆ Install

Install via 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": "<latest version>"
}
}

๐Ÿš€ Quick Start (Hello World)

<?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;

$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,
]);

$db = new ZTeraDBConnection(
getenv("ZTERADB_HOST"),
getenv("ZTERADB_PORT"),
$config
);

$query = (new ZTeraDBQuery("user"))->select();

foreach ($db->run($query) as $row) {
print_r($row);
}

$db->close();

๐Ÿ—‚ Documentation Sections