PHP code example of ecommercebox / actionml

1. Go to this page and download the library: Download ecommercebox/actionml 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/ */

    

ecommercebox / actionml example snippets


use actionml\EventClient;
$engineId = 'test_ur';
$client = new EventClient($engineId, 'http://localhost:9090');

// 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('itypes' => 1));

// assume this user has viewed this book item
$client->recordUserActionOnItem('view', 5, 'bookId1');

// assume you have created an itemrank engine on localhost:9090
// we try to get ranking of 5 items (item IDs: 1, 2, 3, 4, 5) for a user (user ID 7)

$engineClient = new EngineClient('test_ur');
$response = $engineClient->queryItemSet(aray(7,4,6));

print_r($response);