resnext/spotoption-api-client
Composer 安装命令:
composer require resnext/spotoption-api-client
包简介
PHP Client for SpotOption platform
README 文档
README
API Client for binary options platform SpotOption.
Installation
Install using Composer, doubtless.
$ composer require resnext/spotoption-api-client
General API Client usage.
$apiClient = new SpotOption\ApiClient(<URL>, <USERNAME>, <PASSWORD>);
Error handling
Each method of \SpotOption\ApiClient can return response object (instance of \SpotOption\Response) or throws two kind of exceptions.
- \SpotOption\ServerException Server-side exception assigned with invalid data received of impossible operation is requested.
- \SpotOption\ClientException Client-side exception means API Client cannot connect to SpotOption servers or receive invalid response with any reasons.
Configuration and customization
Your can configure used HTTP client using $options param of ApiClient constructor.
Example:
$httpClient = new GuzzleHttp\Client([ GuzzleHttp\RequestOptions::CONNECT_TIMEOUT => 2, ]); $apiClient = new \SpotOption\ApiClient(<API_URL>, <API_USERNAME>, <API_PASSWORD>, [ 'httpClient' => $httpClient, ]);
Countries retrieving
/** @var \SpotOption\Responses\GetCountriesResponse $response */ $response = $this->apiClient->getCountries(); /** @var \SpotOption\Entities\Country[] $countries */ $countries = $response->getData();
Campaigns retrieving
This example retrieves all campaign with type CPA.
/** @var \SpotOption\Responses\GetCampaigns $response */ $response = $this->apiClient->getCampaigns(\SpotOption\Entities\Campaign::TYPE_CPA); /** @var \SpotOption\Entities\Campaign[] $countries */ $countries = $response->getData();
Customer validation
/** @var \SpotOption\Responses\ValidateCustomerResponse $response = $apiClient->validateCustomer('email@domain.com', 'password');
统计信息
- 总下载量: 32
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-19