ecommercebox / actionml
ActionML Harness API PHP Client
0.9.0
2020-12-17 08:41 UTC
Requires
- php: >=5.6.0
- guzzlehttp/guzzle: ^6.5.5
Requires (Dev)
- phpunit/phpunit: ^5
- symfony/class-loader: ^2.3
This package is auto-updated.
Last update: 2024-04-29 04:40:26 UTC
README
Prerequisites
- PHP 5.6+ (http://php.net/)
- PHP: cURL (http://php.net/manual/en/book.curl.php)
- Phing (http://www.phing.info/)
- ApiGen (http://apigen.org/)
Note: This SDK only supports ActionML version 0.6 or higher.
Getting Started
The easiest way to install ActionML PHP client is to use Composer.
-
actionml
is available on Packagist and can be installed using Composer:composer require ecommercebox/actionml
-
Include Composer's autoloader in your PHP code
require_once("vendor/autoload.php");
Usage
This package is a web service client based on Guzzle. A few quick examples are shown below.
Instantiate ActionML API Event Client
use actionml\EventClient; $engineId = 'test_ur'; $client = new EventClient($engineId, 'http://localhost:9090');
Set a User Record from Your App
// assume you have a user with user ID 5 $response = $client->setUser(5);
Set an Item Record from Your App
// 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));
Import a User Action (View) form Your App
// assume this user has viewed this book item $client->recordUserActionOnItem('view', 5, 'bookId1');
Retrieving Prediction Result
// 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);
Bugs and Feature Requests
Use ActionML PHP SDK Issues to report bugs or request new features.
Contributing
Read the Contribute Code page.
License
Apache PredictionIO is under Apache 2 license.