phpinnacle / cassis
PHPinnacle async Cassandra client
0.0.1
2019-04-04 09:36 UTC
Requires
- php: ^7.2
- amphp/amp: ^2.0
- amphp/socket: ^0.10
- phpinnacle/buffer: ^1.0
Requires (Dev)
- phpbench/phpbench: ^0.16
- phpunit/phpunit: ^8.0
- ramsey/uuid: ^3.8
Suggests
- ext-gmp: For use Varint and Decimal Cassandra types
- ext-lz4: For use LZ4 compression mechanism
- ext-snappy: For use Google Snappy compression mechanism
- ramsey/uuid: For use Uuid and Timeuuid Cassandra types
This package is auto-updated.
Last update: 2024-11-04 22:02:28 UTC
README
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.