tag | e772dfc26c7f3627575ddd4668ce3f1693e64ebd | |
---|---|---|
tagger | Paul Li <paul@prediction.io> | Fri Nov 21 18:19:05 2014 -0800 |
object | 31fbfb50e0f3e381b0be0ccf247ffbf2dd1d5a98 |
v0.8.2 release
commit | 31fbfb50e0f3e381b0be0ccf247ffbf2dd1d5a98 | [log] [tgz] |
---|---|---|
author | Paul Li <paul@prediction.io> | Fri Nov 21 17:29:36 2014 -0800 |
committer | Paul Li <paul@prediction.io> | Fri Nov 21 17:29:36 2014 -0800 |
tree | 6e0d9e71eb8eecdfb0346079ce93ab791c494c6a | |
parent | 37fb79a5043e8c1ef58a722611347538279f70db [diff] | |
parent | 197afadfe95da8cec394c8b642442f6053d16df4 [diff] |
Merge branch 'develop'
Note: This SDK only supports Prediction IO version 0.8.2 or higher.
https://groups.google.com/group/predictionio-user
https://predictionio.atlassian.net
If you are unsure whether a behavior is an issue, bringing it up in the forum is highly encouraged.
The easiest way to install PredictionIO PHP client is to use Composer.
Add predictionio/predictionio
as a dependency in your project's composer.json
file:
{ "require": { "predictionio/predictionio": "~0.8.2" } }
Install Composer:
curl -sS https://getcomposer.org/installer | php -d detect_unicode=Off
Use Composer to install your dependencies:
php composer.phar install
Include Composer's autoloader in your PHP code
require_once("vendor/autoload.php");
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.
use predictionio\EventClient; $accessKey = 'j4jIdbq59JsF2f4CXwwkIiVHNFnyNvWXqMqXxcIbQDqFRz5K0fe9e3QfqjKwvW3O'; $client = new EventClient($accessKey, 'http://localhost:7070');
// assume you have a user with user ID 5 $response = $client->setUser(5);
// assume you have a book with ID 'bookId1' and we assign 1 as the type ID for book $response = $client->setItem('bookId1', array('pio_itypes' => 1));
// assume this user has viewed this book item $client->recordUserActionOnItem('view', 5, 'bookId1');
// assume you have created an itemrank engine on localhost:8000 // we try to get ranking of 5 items (item IDs: 1, 2, 3, 4, 5) for a user (user ID 7) $engineClient = new EngineClient('http://localhost:8000'); $response = $engineClient->sendQuery(array('uid'=>7, 'iids'=>array(1,2,3,4,5))); print_r($rec);