Akiban Server has a REST API. This client allows easy interaction with this API.
Create composer.json
file in your project root:
{
"require": {
"akiban/akiban-php": "dev-master"
}
}
Then download composer.phar
and run the install command:
curl -s http://getcomposer.org/installer | php && ./composer.phar install
<?php
require 'vendor/autoload.php';
use Akiban\AkibanClient;
// Instantiate an Akiban client
$client = AkibanClient::factory(array('scheme' => 'https',
'username' => 'user',
'password' => 'pass',
'hostname' => 'localhost'));
// Retrieve an entity named 'hopes' with an ID of 3
// returns a JSON document representing the entity
echo $client->getEntity('hopes', 3);
// Execute a SQL query
// results are returned in JSON format
echo $client->executeSqlQuery('select * from hopes');
// Execute multiple SQL statements in 1 transaction
// results for each statement are returned as a field
// in a JSON document
$queries = array(
'select max(id) from hopes',
'select * from hopes'
);
echo $client->executeMultipleSqlQueries($queries);