1. Go to this page and download the library: Download recsys/common 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/ */
recsys / common example snippets
namespace Recsys;
use Recsys\Common\AbstractGateway;
class TestGateway extends AbstractGateway
{
// Report multi-items
public function reportItems(array $parameters)
{
...
}
// Report one item
public function reportItem(array $parameter)
{
...
}
// Remove multi-items
public function removeItems(array $itemIds)
{
...
}
// Remove one item
public function removeItem($itemId)
{
...
}
// Search multi-items
public function findItems(array $itemIds)
{
...
}
// Search one item
public function findItem($itemId)
{
...
}
// Report user multi-actions
public function reportActions(array $parameters)
{
...
}
// Report user one action
public function reportAction($parameter)
{
...
}
// Get a recommend result
public function recommend(array $parameters)
{
...
}
}
namespace Recsys;
use Recsys\Common\Message\AbstractRequest;
class TestRequest extends AbstractRequest
{
// Handle your data and return them
public function getData()
{
...
}
// Make a http request to remote api, return a response implements \Recsys\Common\Message\ResponseInterface
public function sendData($data)
{
...
return new TestResponse($this, $data);
}
}
namespace Recsys;
use Recsys\Common\Message\AbstractResponse;
class TestResponse extends AbstractResponse
{
public function isSuccessful()
{
...
}
}
use Recsys\Recsys;
use Recsys\TestGateway;
$gateway = Recsys::create(TestGateway::class);
...
$response = $gateway->recommend($options);
if ($response->isSuccessful()) {
print_r($response);
} else {
...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.