PHPackages                             endroid/prediction-io - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. endroid/prediction-io

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

endroid/prediction-io
=====================

Endroid PredictionIo Client

3.0.0(8y ago)173.3k8MITPHPPHP &gt;=7.1

Since Oct 22Pushed 7y ago1 watchersCompare

[ Source](https://github.com/endroid/prediction-io)[ Packagist](https://packagist.org/packages/endroid/prediction-io)[ Docs](https://github.com/endroid/prediction-io)[ RSS](/packages/endroid-prediction-io/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependencies (3)Versions (34)Used By (0)

Prediction IO
=============

[](#prediction-io)

*By [endroid](https://endroid.nl/)*

[![Build Status](https://camo.githubusercontent.com/bfa6d8887510b8dc5304e6c5a82f8ac9f7e5488afe43d462bae43e3377b0a40f/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f656e64726f69642f70726564696374696f6e2d696f2e737667)](http://travis-ci.org/endroid/prediction-io)[![Latest Stable Version](https://camo.githubusercontent.com/c388d4f97540c32e98c78be5911116836bc8065ab4201c47ce124bd6c2afa0d5/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656e64726f69642f70726564696374696f6e2d696f2e737667)](https://packagist.org/packages/endroid/prediction-io)[![Total Downloads](https://camo.githubusercontent.com/e3c9f0b6c2494a5f56e353b6ddcf88233d911d56524a3b0a18a7025d57d80f65/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656e64726f69642f70726564696374696f6e2d696f2e737667)](https://packagist.org/packages/endroid/prediction-io)[![License](https://camo.githubusercontent.com/375fd1698470caed6c3e90456f81a627ac6c6fb4da1d2a266d795af89d213613/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f656e64726f69642f70726564696374696f6e2d696f2e737667)](https://packagist.org/packages/endroid/prediction-io)

The Prediction IO 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`](http://prediction.io/) recommendation engine. Applications range from showing recommended products in a web shop to discovering relevant experts in a social collaboration network.

[![Recommendations](https://raw.githubusercontent.com/endroid/PredictionIo/master/src/Bundle/Resources/public/images/recommendations.png)](https://raw.githubusercontent.com/endroid/PredictionIo/master/src/Bundle/Resources/public/images/recommendations.png)

Requirements
------------

[](#requirements)

- Symfony
- Dependencies:
- [`PredictionIo-PHP-SDK`](https://github.com/PredictionIo/PredictionIo-PHP-SDK)

Installation
------------

[](#installation)

Use [Composer](https://getcomposer.org/) to install the library.

```
$ composer require endroid/prediction-io
```

Usage
-----

[](#usage)

```
use Endroid\PredictionIo\EventClient;
use Endroid\PredictionIo\EngineClient;

$apiKey = '...';
$eventClient = new EventClient($apiKey);
$recommendationEngineClient = new EngineClient('http://localhost:8000');
$similarProductEngineClient = new EngineClient('http://localhost:8001');

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

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

// Return recommendations
$itemCount = 20;
$recommendedProducts = $recommendationEngineClient->getRecommendedItems('user_1', $itemCount);
$similarProducts = $similarProductEngineClient->getSimilarItems('product_1', $itemCount);
```

Symfony integration
-------------------

[](#symfony-integration)

Register the Symfony bundle in the kernel.

```
// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new Endroid\PredictionIo\Bundle\PredictionIoBundle\EndroidPredictionIoBundle(),
    ];
}
```

The default parameters can be overridden via the configuration.

```
endroid_prediction_io:
    event_server:
        url: http://localhost:7070
    apps:
        app_one:
            key: '...'
            engines:
                recommendation:
                    url: http://localhost:8000
                similarproduct:
                    url: http://localhost:8001
                viewedthenbought:
                    url: http://localhost:8002
                complementarypurchase:
                    url: http://localhost:8003
                productranking:
                    url: http://localhost:8004
                leadscoring:
                    url: http://localhost:8005
        app_two:
            key: '...'
            engines:
                complementarypurchase:
                    url: http://localhost:8006
                leadscoring:
                    url: http://localhost:8007

```

Now you can retrieve the event and engine clients as follows.

```
/** @var EventClient $eventClient */
$eventClient = $this->get('endroid.prediction_io.app_one.event_client');

/** @var EngineClient $recommendationEngineClient */
$recommendationEngineClient = $this->get('endroid.prediction_io.app_one.recommendation.engine_client');

/** @var EngineClient $similarProductEngineClient */
$similarProductEngineCl![Recommendations](https://raw.githubusercontent.com/endroid/PredictionIo/master/assets/recommendations.png)ient = $this->get('endroid.prediction_io.app_one.similarproduct.engine_client');
```

Docker
------

[](#docker)

Many Docker images exist for running a PredictionIo server. Personally I used the [`spereio`](https://github.com/sphereio/docker-predictionio) image to create an image that creates, trains and deploys a recommendation engine and starts the PIO server. It starts a cron that trains the model every 5 minutes. You can find that image [`here`](https://github.com/endroid/docker/tree/master/docker/prediction-io).

Vagrant box
-----------

[](#vagrant-box)

PredictionIo provides a [`Vagrant box`](https://docs.prediction.io/install/install-vagrant/)containing an out-of-the-box PredictionIo server.

Versioning
----------

[](#versioning)

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.

License
-------

[](#license)

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.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 88.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~51 days

Recently: every ~44 days

Total

32

Last Release

2994d ago

Major Versions

1.0.6 → 2.0.02015-06-01

2.x-dev → 3.0.02018-03-04

PHP version history (4 changes)1.0.0PHP &gt;=5.3.0

1.0.6PHP &gt;=5.4.0

2.1.0PHP &gt;=5.4

3.0.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/ea3fc1b297f29579f9861b5fbe3240c0eeafaaaee6e39b45d85d612a04a52fbd?d=identicon)[endroid](/maintainers/endroid)

---

Top Contributors

[![endroid](https://avatars.githubusercontent.com/u/537253?v=4)](https://github.com/endroid "endroid (77 commits)")[![habashyjr](https://avatars.githubusercontent.com/u/1475873?v=4)](https://github.com/habashyjr "habashyjr (10 commits)")

---

Tags

phpioendroidpredictionpredictionio

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/endroid-prediction-io/health.svg)

```
[![Health](https://phpackages.com/badges/endroid-prediction-io/health.svg)](https://phpackages.com/packages/endroid-prediction-io)
```

###  Alternatives

[endroid/qr-code

Endroid QR Code

4.8k67.6M348](/packages/endroid-qr-code)[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)[bratao/prediction-io

Laravel PredictionIO Client

241.6k](/packages/bratao-prediction-io)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
