PHP code example of openpublicmedia / roisolutions-php

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

    

openpublicmedia / roisolutions-php example snippets


use OpenPublicMedia\RoiSolutions\Rest\Client;

$userId = 'USER_ID';
$password = 'pAsSw0rD';
$clientCode = 'CLIENTCODE';

$client = new Client($userId, $password, $clientCode);

use OpenPublicMedia\RoiSolutions\Rest\Client;
use Tochka\Cache\ArrayFileCache;

$userId = 'USER_ID';
$password = 'pAsSw0rD';
$clientCode = 'CLIENTCODE';
$cache = new ArrayFileCache('.', 'my_awesome_cache');

$client = new Client($userId, $password, $clientCode, cache: $cache);

use OpenPublicMedia\RoiSolutions\Rest\Exception\RequestException;

try {
    $results = $client->request('get', 'donors');
} catch (RequestException $e) {
    var_dump(get_class($e));
    var_dump($e->getMessage());
    var_dump($e->getCode());
    var_dump($e->getStatusCodeReported());
    var_dump($e->getTitle());
    var_dump($e->getDetail());
    var_dump($e->getInstanceCode());
    var_dump($e->getHelpLink());
}
bash
composer