Apache Cassandra package for Fuel. It includes a PHP client library for Apache Cassandra : phpcassa as a submodule.
The Apache Cassandra Project develops a highly scalable second-generation distributed database, bringing together Dynamo's fully distributed design and Bigtable's ColumnFamily-based data model.
Get this package in you app
$ cd MYAPP/
$ git submodule add git://github.com/ooXavier/fuel-cassandra.git fuel/packages/cassandra
$ git submodule init
$ git submodule update
$ cd fuel/packages/cassandra/
$ git submodule init
$ git submodule update
$ cd ../../..
Then simply add cassandra
to your config.php always_loaded.packages
config option.
'always_load' => array(
'packages' => array(
// ...
'cassandra',
),
// ...
Copy config file model into your application
$ cp fuel/packages/cassandra/config/cassandra.php fuel/app/config/
Edit the file to set-up the connection to your cassandra server installation. Example :
<?php
return array(
'path' => 'phpcassa',
'cassandra' => array(
'default' => array(
'keyspace' => 'CineMQstaging1',
'servers' => array (
'127.0.0.1:9160',
)
)
),
);
// Get a an new instance of configured nodes on a defined keyspace
$cass = Cassandra::instance('default');
// Creating a simple keyspace with replication factor 1
$cass->
// Creating a column family with a single validated column
$cass->
// Create an index on the name
$cass->
// Insert with FuelPHP DB Query
$query = DB::insert('users', array('KEY', 'email'))->values(array('toto', 'toto@perdu.com'));
$cass->
// Update
$cass->
// Select all
$cass->
// Select just one user by id
$cass->
// Select just one user by indexed column
$cass->
// Delete the swarthy bastard Kevin
$cass->