2017 © Pedro Peláez
 

library react-cassandra

Performant pure-PHP CQL (Cassandra) async (ReactPHP) library

image

tatikoma/react-cassandra

Performant pure-PHP CQL (Cassandra) async (ReactPHP) library

  • Thursday, January 11, 2018
  • by Tatikoma
  • Repository
  • 1 Watchers
  • 4 Stars
  • 50 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Tatikoma\React\Cassandra

Performant pure-PHP CQL v4 (Cassandra) async (ReactPHP) library., (*1)

Library is not ready for production and much of functional is not implemented yet., (*2)

Installation, (*3)

php composer.phar require tatikoma/react-cassandra:dev-master

Example usage (async mode):, (*4)

 require_once 'vendor/autoload.php';

 $loop = React\EventLoop\Factory::create();

 $cluster = new \Tatikoma\React\Cassandra\Async\Cluster($loop, [
     ['host' => '127.0.0.1'],
     ['host' => '127.0.0.2'],
     ['host' => '127.0.0.3'],
     ['host' => '127.0.0.4'],
 ]);
 $cluster->connect('test')->then(function() use($cluster){
     print "Connected to cluster keyspace test\n";
     $uuid = '00000000-0000-0000-0000-000000000000';
     return $cluster->query('
        SELECT *
        FROM example
        WHERE id = :id
     ',[
        'id' => new \Tatikoma\React\Cassandra\Type\UUID($uuid),
     ]);
 })->then(function($response){
     print "Query successfull, got " . count($response->results) . " rows:\n";
     foreach($response as $row){
        var_dump($row);
     }
 }, function(\Tatikoma\React\Cassandra\Protocol\ErrorFrame $reason){
     print "Query failed: " . $reason->errorString . "\n";
 });

 $loop->run();

Example usage (sync mode):, (*5)

 require_once 'vendor/autoload.php';

 $cluster = new \Tatikoma\React\Cassandra\Cluster([
     ['host' => '127.0.0.1'],
     ['host' => '127.0.0.2'],
     ['host' => '127.0.0.3'],
     ['host' => '127.0.0.4'],
 ]);
 $cluster->connect('test');
 $uuid = '00000000-0000-0000-0000-000000000000';
 $response = $cluster->query('
     SELECT *
     FROM example
     WHERE id = :id
     ',[
        'id' => new \Tatikoma\React\Cassandra\Type\UUID($uuid),
 ]);
 print "got " . count($response->results) . " rows:\n"; 
 foreach($response as $row){
    var_dump($row);
 }

The Versions

11/01 2018

dev-master

9999999-dev

Performant pure-PHP CQL (Cassandra) async (ReactPHP) library

  Sources   Download

MIT

The Requires

 

by Avatar Tatikoma

cassandra react reactphp react-php cql react-cassandra