This library is a pure asynchronous PHP implementation of the Cassandra V4 binary protocol. It utilize amphp framework for async operations.
Via Composer
$ composer require phpinnacle/cassis
<?php
use Amp\Loop;
use PHPinnacle\Cassis\Cluster;
use PHPinnacle\Cassis\Session;
use PHPinnacle\Cassis\Statement;
require __DIR__ . '/vendor/autoload.php';
Loop::run(function () {
$cluster = Cluster::build('tcp://localhost:9042');
/** @var Session $session */
$session = yield $cluster->connect('system');
$statement = new Statement\Simple('SELECT keyspace_name, columnfamily_name FROM schema_columnfamilies');
$result = yield $session->execute($statement);
foreach ($result as $row) {
printf("The keyspace %s has a table called %s\n", $row['keyspace_name'], $row['columnfamily_name']);
}
$session->close();
});
More examples can be found in examples
directory. Run it with:
CASSIS_EXAMPLE_DSN=tcp://user:pass@localhost:9042 php example/*
CASSIS_TEST_DSN=tcp://user:pass@localhost:9042 composer test
CASSIS_BENCHMARK_DSN=tcp://user:pass@localhost:9042 composer bench
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email dev@phpinnacle.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.