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.
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.
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
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();