2.0.8 2016-11-08 21:00 UTC


By endroid

Build Status Latest Stable Version Total Downloads License

The PredictionIO library provides a client which offers easy access to a PredictionIO recommendation engine. PredictionIO is an open source machine learning server for software developers to create predictive features, such as personalization, recommendation and content discovery.

Through a small set of simple calls, all server functionality is exposed to your application. You can add users and items, register actions between these users and items and retrieve recommendations deduced from this information by any PredictionIO recommendation engine. Applications range from showing recommended products in a web shop to discovering relevant experts in a social collaboration network.



Use Composer to install the library.

$ composer require endroid/prediction-io



use Endroid\PredictionIO\EventClient;
use Endroid\PredictionIO\EngineClient;

$eventClient = new EventClient($apiKey, $eventServerUrl);
$engineClient = new EngineClient($engineUrl);

// Populate with users and items
$userProperties = ['address' => '1234 Street, San Francisco, CA 94107', 'birthday' => '22-04-1991'];
$eventClient->createUser($userId, $userProperties);
$itemProperties = ['categories' => [123, 1234, 12345]];
$eventClient->createItem($itemId, $itemProperties);

// Record actions
$actionProperties = ['firstView' => true];
$eventClient->recordUserActionOnItem('view', $userId, $itemId, $actionProperties);

// Return recommendations
$itemCount = 20;
$recommendedItems = $engineClient->getRecommendedItems($userId, $itemCount);
$similarItems = $engineClient->getSimilarItems($itemId, $itemCount);

Vagrant box

PredictionIO provides a Vagrant box containing an out-of-the-box PredictionIO server.


You can use EndroidPredictionIOBundle to enable this service in your Symfony application.


Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatible changes will be kept to a minimum but be aware that these can occur. Lock your dependencies for production and test your code when upgrading.


This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.