TriCoreDB for PHP
v0.1.0The official PHP client: SQL, documents, cache, vectors and graphs over one native connection.
Install
composer
composer require tricoredb/tricoredbRequirements
- PHP 8.1 or later with ext-json
- ext-openssl for TLS
- A TriCoreDB server, 0.1.0-rc.1 or later (install one)
Highlights
- No runtime dependencies: PHP streams and ext-json
- Exact Decimal and Bytes values
- Transactions, TLS and mutual TLS
Quick start
index.php
<?php
require __DIR__ . '/vendor/autoload.php';
use TriCoreDb\Client;
$db = Client::connect(host: '127.0.0.1', port: 8427, user: 'admin', secret: 'your-password');
$db->execute('CREATE TABLE IF NOT EXISTS people (id INT PRIMARY KEY, name TEXT, score DOUBLE)');
$db->execute('INSERT INTO people VALUES (?, ?, ?)', [1, 'ada', 9.5]);
$rows = $db->query('SELECT name, score FROM people WHERE id = ?', [1]);
echo $rows->value(0, 'name'); // ada
$db->close();TLS
This example connects without TLS, which matches the development container. The default image requires TLS. The README shows how to connect with a CA certificate, and documents every call.