phpinnacle/cassis

PHPinnacle async Cassandra client

0.0.1 2019-04-04 09:36 UTC

This package is auto-updated.

Last update: 2024-04-04 20:50:40 UTC


README

Latest Version on Packagist Software License Coverage Status Quality Score Total Downloads

This library is a pure asynchronous PHP implementation of the Cassandra V4 binary protocol. It utilize amphp framework for async operations.

Install

Via Composer

$ composer require phpinnacle/cassis

Basic Usage

<?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/*

Testing

CASSIS_TEST_DSN=tcp://user:pass@localhost:9042 composer test

Benchmarks

CASSIS_BENCHMARK_DSN=tcp://user:pass@localhost:9042 composer bench

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email dev@phpinnacle.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.