This library abstracts interactions with ROI Solutions APIs.
Install via composer:
composer require openpublicmedia/roisolutions-php
The OpenPublicMedia\RoiSolutions\Rest\Client
queries the REST API.
use OpenPublicMedia\RoiSolutions\Rest\Client;
$userId = 'USER_ID';
$password = 'pAsSw0rD';
$clientCode = 'CLIENTCODE';
$client = new Client($userId, $password, $clientCode);
Providing a cache service is also supported (and recommended) when creating the client. If the client has a cache service it will be used to cache the authentication token provided by the API across multiple requests for the lifetime of the token.
A PSR-16 compliant interface is preferred but any class providing
set($key, $value)
and get($key, $default)
methods will suffice.
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);
Custom exceptions are provided for 404 response and general errors. Additional information from the API response is captured in these exceptions.
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());
}
See CONTRIBUTING for information about contributing to this project.
- REST API client (
\OpenPublicMedia\RoiSolutions\Rest\Client
) - API direct querying (
$client->request()
) - Result/error handling
- System
- Donors
- Search donors
- Account flags support
- Sub-resources support
- Get donor
- Support for advanced query parameters (
include
,summary.*
,donations.*
) - Get flags (BETA)
- Get emails
- Get Passport memberships (BETA)
- Membership ID property
- Other properties (once finalized)
- Support for advanced query parameters (
- Create donor (BETA)
- Update donor (BETA)
- Search donors