resnext/solaris-api-client 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

resnext/solaris-api-client

Composer 安装命令:

composer require resnext/solaris-api-client

包简介

PHP Client for Solaris platform

README 文档

README

API Client for binary options platform Solaris.

Installation

Install using Composer, doubtless.

$ composer require resnext/solaris-api-client

General API Client usage.

Your can configure used HTTP client using $options param of ApiClient constructor.

Error handling

Each method of \Solaris\ApiClient can return response object (instance of \Solaris\Response) or throws two kind of exceptions.

  1. \Solaris\ServerException Server-side exception assigned with invalid data received of impossible operation is requested.
  2. \Solaris\ClientException Client-side exception means API Client cannot connect to Solaris servers or receive valid response with any reasons.

Configuration and customization

Example:

$httpClient = new GuzzleHttp\Client([
   GuzzleHttp\RequestOptions::CONNECT_TIMEOUT => 2,
]);

$apiClient = new \Solaris\ApiClient(<API_URL>, <API_USERNAME>, <API_PASSWORD>, [
    'httpClient' => $httpClient,
]);

Get available countries list

For customer adding you need specify countryISO 3166-1 code (ex.: en, us, gb). You can get available for registration countries list as bellow:

/** @var \Solaris\Responses\GetCountriesResponse $response */
$response = $apiClient->getCountries();
/** @var \Solaris\Entities\Country[] $countries */
$countries = $response->getCountries();

Add customer

Customer's adding is main method of any trade platform...

$request = new \Solaris\Requests\AddCustomerRequest([
    'firstName' => 'John',
    'lastName' => 'Smith',
    'email' => 'john.smith@domain.com',
    'phone' => '123456789',
    'country' => 'cz',
    'currency' => 'USD',
    'password' => 'qwerty',
]);

/** @var \Solaris\Responses\AddCustomerResponse $response */
$response = $apiClient->addCustomer($request);

Get customer auto-login URL and auth key.

It is really easy:

$request = new \Solaris\Requests\GetCustomerAuthKeyRequest(['email' => 'john.smith@domain.com']);

/**
 * @var \Solaris\Responses\GetCustomerAuthKeyResponse $response
 */
$response = $apiClient->getCustomerAuthKey($request);

echo $response->getAuthUrl();

Deposits retrieving

/** @var \Solaris\Responses\GetDepositsResponse $response */
$response = $apiClient->getDeposits();
/** @var \Solaris\Entities\Deposit[] $deposits */
$deposits = $response->getDeposits();

统计信息

  • 总下载量: 595
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-07-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固