PHP code example of headzoo / prediction-io-bundle

1. Go to this page and download the library: Download headzoo/prediction-io-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

headzoo / prediction-io-bundle example snippets



public function recommendAction()
{
    $client = $this->get('endroid.prediction_io');

    // populate
    $client->createUser($userId);
    $client->createItem($itemId);
    $client->recordAction($userId, $itemId, 'view');

    // get recommendations and similar items
    $recommendations = $client->getRecommendations($userId, $engine, $count);
    $similarItems = $client->getSimilarItems($itemId, $engine, $count);
}
 php

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Endroid\Bundle\PredictionIOBundle\EndroidPredictionIOBundle(),
    );
}