commit | 69fb30d0b8ac010ddcf6a0ec8740f3026ed16d79 | [log] [tgz] |
---|---|---|
author | Donald Szeto <donald@tappingstone.com> | Wed Apr 17 12:48:45 2013 +0800 |
committer | Donald Szeto <donald@tappingstone.com> | Wed Apr 17 12:48:45 2013 +0800 |
tree | cfffd192a927bb089e8e2185543b2879d5bd3324 | |
parent | ac9643ec45f0f88542cda2bf9cfdc90b34253478 [diff] |
Force composer to use guzzle ~3.3.1
Assuming you are cloning to your home directory.
cd ~ git clone git://github.com/PredictionIO/PredictionIO-PHP-SDK.git
To build the SDK,
cd ~/PredictionIO-PHP-SDK phing
Once the build finish you will get a Phar and a set of API documentation.
For a list of supported commands, please refer to the API documentation.
This package is a web service client based on Guzzle. A few quick examples are shown below.
For a full user guide on how to take advantage of all Guzzle features, please refer to http://guzzlephp.org. Specifically, http://guzzlephp.org/tour/using_services.html#using-client-objects describes how to use a web service client.
Many REST request commands support optional arguments. They can be supplied to these commands by the set
method.
require_once("predictionio.phar"); use PredictionIO\PredictionIOClient; $client = PredictionIOClient::factory(array("appkey" => "<your app key>"));
// (your user registration logic) $uid = get_user_from_your_db(); $command = $client->getCommand('create_user', array('uid' => $uid)); $response = $client->execute($command); // (other work to do for the rest of the page)
$client->execute($client->getCommand('user_view_item', array('uid' => '4', 'iid' => '15'))); // (other work to do for the rest of the page)
$client->execute($client->getCommand('itemrec_get_top_n', array('engine' => 'test', 'uid' => '4', 'n' => 10))); // (work you need to do for the page (rendering, db queries, etc))