ixolit / dislo-backend-sdk
This package is abandoned and no longer maintained.
The author suggests using the ixoplan/ixoplan-backend-sdk package instead.
Client library for backend Ixoplan APIs
v1.0.3
2021-04-29 11:24 UTC
Requires
- ixoplan/ixoplan-sdk: 1.0.*
Requires (Dev)
- apigen/apigen: 4.1.*
- ixoplan/ixoplan-sdk-http-guzzle: 1.0.*
- phing/phing: 2.14.*
- phpmd/phpmd: 2.4.*
- phpunit/phpunit: 4.8.*
This package is auto-updated.
Last update: 2021-08-31 15:30:26 UTC
README
PHP SDK for the Ixoplan Backend API
Installation
Simply add ixoplan/ixoplan-backend-sdk and a provider of ixoplan/ixoplan-sdk-http (e.g. ixoplan/ixoplan-sdk-http-guzzle) to your composer.json, e.g:
{
"name": "myvendor/myproject",
"description": "Using ixoplan-backend-sdk",
"require": {
"ixoplan/ixoplan-backend-sdk": "*"
"ixoplan/ixoplan-sdk-http-guzzle": "*"
}
}
Usage
Instantiate the Client
The client is designed for different transport layers. It needs a RequestClient interface (e.g. HTTPRequestClient) to actually communicate with Ixoplan.
use Ixolit\Dislo\Backend\Client;
use Ixolit\Dislo\HTTP\Guzzle\GuzzleHTTPClientAdapter;
use Ixolit\Dislo\Request\HTTPRequestClient;
$httpAdapter = new GuzzleHTTPClientAdapter();
$httpClient = new HTTPRequestClient(
$httpAdapter,
$host,
$apiKey,
$apiSecret
);
$apiClient = new Client($httpClient);
Coupons
Retrieve a list of all coupons in multiple requests, each limited to ten items:
$apiClient = new \Ixolit\Dislo\Backend\Client($httpClient);
$limit = 10;
$offset = 0;
do {
$couponListResponse = $apiClient->couponList($limit, $offset);
foreach ($couponListResponse->getCoupons() as $coupon) {
echo $coupon->getCode();
$offset++;
}
} while ($offset < $couponListResponse->getTotalCount());