Skip to content

ScyllaDB PHP DriverNative CQL for PHP 8

A C extension that speaks the CQL binary protocol directly. Built on the ScyllaDB C/C++ driver, with token-aware routing, prepared statements, async futures, and full CQL type support.

ScyllaDB PHP driver

From zero to a query

php
<?php

$session = Cassandra::cluster()
    ->withContactPoints('10.0.0.1', '10.0.0.2', '10.0.0.3')
    ->withPort(9042)
    ->withCredentials('scylla', getenv('SCYLLA_PASSWORD'))
    ->withDefaultConsistency(Cassandra::CONSISTENCY_LOCAL_QUORUM)
    ->withTokenAwareRouting(true)
    ->build()
    ->connect('shop');

$statement = $session->prepare('SELECT id, email FROM users WHERE id = ?');

$rows = $session->execute($statement, [
    'arguments' => [new Cassandra\Uuid('7b5a4c1e-8f2a-4c9e-9a1b-3c2d1e0f5a6b')],
]);

foreach ($rows as $row) {
    printf("%s <%s>\n", $row['id'], $row['email']);
}

Read the quick start for a complete first application, or go to clusters and sessions for the full connection model.

Version 1.4. Released under the Apache License 2.0.