alexander-emelyanov/tradesmarter-api-client
Composer 安装命令:
composer require alexander-emelyanov/tradesmarter-api-client
包简介
PHP Client for TradeSmarter platform
README 文档
README
This repository contains PHP Client for TradeSmarter platform.
TradeSmarter is a trading platform for binary options.
Installation
Install using Composer, doubtless.
$ composer require alexander-emelyanov/tradesmarter-api-client
Usage
First, you need to create a client object to connect to the TradeSmarter servers. You will need to acquire an API username and API password for your app first from broker, then pass the credentials to the client object for logging in.
$client = new \TradeSmarter\ApiClient("https://<username>:<password>@<hostname>");
Assuming your credentials is valid, you are good to go!
Get countries list
/** @var \TradeSmarter\Responses\Country[] $countries */ $countries = $client->countries();
Register new customer
$request = new TradeSmarter\Requests\Register([ 'firstName' => 'John', 'lastName' => 'Smith', 'email' => 'john.smith@gmail.com', 'confirmed' => 1, 'password' => 'qwerty', 'phone' => '+123456789', 'country' => 'gb', 'locale' => 'en-GB', 'params' => [], 'lead' => 0, ]); /** @var \TradeSmarter\Responses\Register $response */ $response = $client->register($request);
Login user
$request = new \TradeSmarter\Requests\Login([ 'email' => 'john.smith@gmail.com', 'password' => 'qwerty', ]); /** @var \TradeSmarter\Responses\Login $response */ $response = $client->login($request);
Get user info
$request = new \TradeSmarter\Requests\Login([ 'email' => 'john.smith@gmail.com', 'password' => 'qwerty', ]); /** @var \TradeSmarter\Responses\UserInfo $response */ $response = $client->getUserInfo($request);
Contribution
You are welcome!
Running tests
You can run unit tests via PHPUnit:
$ vendor/bin/phpunit tests
Note: you should install dev dependencies for this package using
$ composer update --dev
统计信息
- 总下载量: 1.87k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-03-09