2017 © Pedro Peláez
 

library laravel-cassandra

A Cassandra based Eloquent model and Query builder for Laravel (Casloquent)

image

dbyzero/laravel-cassandra

A Cassandra based Eloquent model and Query builder for Laravel (Casloquent)

  • Wednesday, September 20, 2017
  • by dbyzero
  • Repository
  • 0 Watchers
  • 1 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 2 Versions
  • 13 % Grown

The README.md

Laravel Cassandra

Build Status Scrutinizer Code Quality Donate, (*1)

A Cassandra based Eloquent model and Query builder for Laravel (Casloquent), (*2)

WARNING: This is a work in progress... not ready for usage yet., (*3)

Installation

Laravel version Compatibility

Laravel Package
5.4.x dev-master

Make sure you have the Cassandra PHP driver installed (version 1.2+). You can find more information at http://datastax.github.io/php-driver/., (*4)

Installation using composer:, (*5)

composer require fuitad/laravel-cassandra

And add the service provider in config/app.php:, (*6)

fuitad\LaravelCassandra\CassandraServiceProvider::class,

(haven't tested with Lumen yet... TODO), (*7)

The service provider will register a cassandra database extension with the original database manager. There is no need to register additional facades or objects. When using cassandra connections, Laravel will automatically provide you with the corresponding cassandra objects., (*8)

For usage outside Laravel, check out the Capsule manager and add:, (*9)

$capsule->getDatabaseManager()->extend('cassandra', function($config)
{
    return new fuitad\LaravelCassandra\Connection($config);
});

Configuration

Change your default database connection name in config/database.php:, (*10)

'default' => env('DB_CONNECTION', 'cassandra'),

And add a new cassandra connection:, (*11)

'cassandra' => [
    'driver'   => 'cassandra',
    'host'     => env('DB_HOST', 'localhost'),
    'port'     => env('DB_PORT', 9142),
    'keyspace' => env('DB_DATABASE'),
    'username' => env('DB_USERNAME'),
    'password' => env('DB_PASSWORD'),
],

You can connect to multiple servers with the following configuration:, (*12)

'cassandra' => [
    'driver'   => 'cassandra',
    'host'     => ['server1', 'server2'],
    'port'     => env('DB_PORT', 9142),
    'keyspace' => env('DB_DATABASE'),
    'username' => env('DB_USERNAME'),
    'password' => env('DB_PASSWORD'),
],

Eloquent

TODO, (*13)

Query Builder

The database driver plugs right into the original query builder. When using cassandra connections, you will be able to build fluent queries to perform database operations., (*14)

$users = DB::table('users')->get();

$user = DB::table('users')->where('name', 'John')->first();

If you did not change your default database connection, you will need to specify it when querying., (*15)

$user = DB::connection('cassandra')->table('users')->get();

Read more about the query builder on http://laravel.com/docs/queries, (*16)

Credits

A lot of the logic behind this package is borrowed from the great Laravel-MongoDB package., (*17)

The Versions

20/09 2017

dev-master

9999999-dev https://github.com/fuitad/laravel-cassandra

A Cassandra based Eloquent model and Query builder for Laravel (Casloquent)

  Sources   Download

MIT

The Requires

 

The Development Requires

database laravel eloquent model cassandra csql casloquent

23/03 2017

dev-travisci

dev-travisci https://github.com/fuitad/laravel-cassandra

A Cassandra based Eloquent model and Query builder for Laravel (Casloquent)

  Sources   Download

MIT

The Requires

 

The Development Requires

database laravel eloquent model cassandra csql casloquent