riiak Client library for Riak key/value store

  1. What is Riak?
  2. Requirements
  3. Resources
  4. Changelog
  5. Usage

This is a PHP client for Riak, built as an extension for Yii Framework. Ported from Basho's official PHP client with numerous changes and slight improvements.

To clarify, this is a client library to provide PHP methods for accessing the Riak REST API. This does not have any code or logic to deal with model's specifically (such as Active Record-style functionality). A separate project/extension will be created to fulfill that need.

What is Riak?

Riak is a Dynamo-inspired key/value store with a distributed database network platform that makes storing and retrieving data simple, safe and low-cost. Riak liberates data from vulnerable centralized databases, allowing it to escape catastrophic losses and surges while accelerating the speed of applications. Riak has no single point of failure. Its multiple nodes create a truly fault-tolerant system for storing any type of mission-critical data.

Requirements

Tested/built using Yii 1.1.8-dev (trunk), with PHP 5.3+. Should work in Yii 1.1.x, may work in Yii 1.0.x

Resources

Changelog

  • 6/02/11: Version 0.1.1 uploaded. Bugfix to documentation and map/reduce methods.
  • 5/31/11: Version 0.1.0 uploaded. Initial conversion from Riak PHP client.

Usage

While the example below does not show it, Riiak is set up as a Yii Application Component, so you can add to your protected/config/main.php a new component entry for Riiak, so that it can be accessed via something like Yii::app()->riak, or you can simply implement as show below.

This quick example assumes that you have a local riak cluster running on port 8098, and have installed the Riiak extension into protected/extensions/riiak/

Yii::import('ext.riiak.*');

# Connect to Riak
$client = new Riiak('127.0.0.1', 8098);

# Choose a bucket name
$bucket = $client->bucket('test');

# Supply a key under which to store your data
$person = $bucket->newObject('riak_developer_1', array(
    'name' => 'John Smith',
    'age' => 28,
    'company' => 'Facebook'
));

# Save the object to Riak
$person->store();

# Fetch the object
$person = $bucket->get('riak_developer_1');

# Update the object
$person->data['company'] = 'Google';
$person->store();
3 0
4 followers
1 515 downloads
Yii Version: 1.1
License: Apache-2.0
Category: Database
Developed by: intel352
Created on: May 31, 2011
Last updated: 6 years ago

Downloads

show all

Related Extensions