beliy/yii2-cassandra-cql

This package is abandoned and no longer maintained. No replacement package was suggested.

A Cassandra CQL3 client wrapper over phpcassa for Yii 2

Installs: 326

Dependents: 0

Suggesters: 0

Security: 0

Stars: 6

Watchers: 2

Forks: 3

Open Issues: 0

Type:yii2-extension

pkg:composer/beliy/yii2-cassandra-cql

dev-master 2016-12-26 09:45 UTC

This package is not auto-updated.

Last update: 2024-08-07 07:10:12 UTC


README

Phpcassa has been deprecated and will no longer be supported! Please use https://github.com/datastax/php-driver

yii2-cassandra-cql

A Cassandra CQL3 client wrapper over phpcassa for Yii 2

Provides object oriented access to Cassandra using CQL3 in a familiar Yii Style. This project is a wrapper over the famous phpcassa library.

This extension also handles issues with the phpcassa library 'Data Types' while using the latest CQL3 API provided by cassandra. The following discussion on StackOverflow describes the problem:

http://stackoverflow.com/questions/16139362/cassandra-is-not-retrieving-the-correct-integer-value

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist beliy/yii2-cassandra-cql "*"

or

composer require beliy/yii2-cassandra-cql:dev-master

or add

"beliy/yii2-cassandra-cql": "*"

to the require section of your composer.json file.

Usage

'components' => [
...
  'cassandra' => [
        'class' => '\beliy\cassandra\Connection',
        'keyspace' => 'youkeyspace',
        'servers' => ['127.0.0.1', ...],
    ],
    'cache' => [
      'class' => '\beliy\cassandra\Cache',
      'tableName' => 'cache', // dedault 'cache'
      'tablePrefix' => 'mega', // default ''
    ],
    ...
  ]

  $cass = Yii::$app->cassandra;
  $cql = 'SELECT value FROM yourtable WHERE id=1';
  $query_result = $cass->cql3Query($cql);
  $rows = $cass->cqlGetRows($query_result);

  Usage for cache:
  First you may init column fammily storage fro cache.
  $cache = Yii::$app->cache;
  $cache->createTable();

  Than use standart Yii2 Cache APIs.

REQUIREMENTS

Yii 2.0.3 / PHP 5.5+

Resources

Fork extensions from http://www.yiiframework.com/extension/cassandra-cql

External Projects used in this extension is the phpcassa library for PHP and Cassandra https://github.com/thobbs/phpcassa