Search by

bzync / nextsql

bzync

Official NextSQL PHP driver. Speaks the native NSQL v1 protocol. Keys never go in URLs.

dev-master 2026-09-06 18:57 UTC

This package is auto-updated.

Last update: 2026-09-06 18:58:21 UTC


README

Official NextSQL driver for PHP 8.1+. Speaks the native NSQL v1 wire protocol over TLS 1.3. No Composer dependencies (needs ext-openssl).

Encryption keys and passwords are never accepted in a connection URL.

composer require bzync/nextsql
<?php
require 'vendor/autoload.php';

$conn = NextSQL\Client::connect([
    'address'  => 'db.example.com:7210',
    'database' => 'production',
    'user'     => 'app',
    'password' => getenv('NEXTSQL_DATABASE_PASS'),
    'tls'      => ['cafile' => '/etc/nextsql/ca.pem', 'servername' => 'db.example.com'],
]);

$res = $conn->exec('SELECT id, name FROM users WHERE id = $1', [1]);
foreach ($res['rows'] as $row) {
    print_r($row);
}
$conn->close();

Plaintext connections are allowed only on loopback ('insecureNoTLS' => true). For an HA cluster with follower-read routing, use NextSQL\Cluster::connect.

MIT licensed.