Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/websmurf/laravel-cassandra
Laravel/Lumen wrapper for Cassandra
https://github.com/websmurf/laravel-cassandra
cassandra laravel lumen
Last synced: about 1 month ago
JSON representation
Laravel/Lumen wrapper for Cassandra
- Host: GitHub
- URL: https://github.com/websmurf/laravel-cassandra
- Owner: websmurf
- License: mit
- Created: 2016-07-27T12:52:33.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-07-29T14:34:08.000Z (over 8 years ago)
- Last Synced: 2023-12-14T20:24:08.800Z (11 months ago)
- Topics: cassandra, laravel, lumen
- Language: PHP
- Homepage:
- Size: 28.3 KB
- Stars: 8
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Laravel/Lumen wrapper for Cassandra
=========[![Build Status](https://scrutinizer-ci.com/g/websmurf/laravel-cassandra/badges/build.png?b=master)](https://scrutinizer-ci.com/g/websmurf/laravel-cassandra/build-status/master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/websmurf/laravel-cassandra/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/websmurf/laravel-cassandra/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/websmurf/laravel-cassandra/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/websmurf/laravel-cassandra/?branch=master)Installation
----This packages uses the cassandra functionality provided by the Datastax php driver.
It needs to be installed before you will be able to use this package. See for more information: [http://datastax.github.io/php-driver/](http://datastax.github.io/php-driver/)Install using composer:
```
composer require websmurf/laravel-cassandra
```After that, register the service provider by adding it in your app.php:
```
$app->register(Websmurf\LaravelCassandra\CassandraServiceProvider::class);
```You can publish the configuration using the following command:
```
php artisan config:publish websmurf/laravel-cassandra
```Or simply create a copy of the config/cassandra.php file in your app/config folder.
After that, change the configuration according to your needs.
Usage
----After installation, you can inject Cassandra in your constructor and use it in your code:
```php
// Inject in the constructor
public function __construct(Cassandra $cassandra, Request $request)
{
$this->cassandra = $cassandra;
}// Create prepared statement
$prepared = $this->cassandra->prepare('THIS IS MY CQL STATEMENT');// Create options for execution
$options = new \Cassandra\ExecutionOptions([
'arguments' => $data,
'consistency' => \Cassandra::CONSISTENCY_ONE
]);// Execute statement
$this->cassandra->execute($prepared, $options);
```