alexander-emelyanov / anyoption-api-client
PHP Client for AnyOption platform
Installs: 1 893
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: >=5.5
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- fzaninotto/faker: ~1.4
- phpunit/phpunit: ^5.1
This package is not auto-updated.
Last update: 2025-01-02 00:12:35 UTC
README
This repository contains PHP Client for AnyOption platform.
AnyOption is the world's first and largest trading platform for binary options, one touch options and dozens of other advanced derivatives.
Installation
Install using Composer, doubtless.
$ composer require alexander-emelyanov/anyoption-api-client
Usage
First, you need to create a client object to connect to the AnyOption servers. You will need to acquire an API username and API password for your app first from AnyOption, then pass the credentials to the client object for logging in.
$client = new \AnyOption\ApiClient([ 'apiUser' => [ 'userName' => '<ANYOPTION_USERNAME>', 'password' => '<ANYOPTION_PASSWORD>' ], 'url' => '<ANYOPTION_URL>' ]);
Also your IP address must be added to whitelist of AnyOption platform. Feel free to contact me for more details.
Assuming your credentials is valid and your IP is whitelisted, you are good to go!
Insert user command
$command = new \AnyOption\Commands\InsertUser([ 'utcOffset' => 0, 'locale' => 'en', 'register' => [ 'firstName' => 'John', 'lastName' => 'Smith', 'email' => 'john.smith@my.com', 'mobilePhone' => '493025922774', 'password' => 'qwerty', 'password2' => 'qwerty', 'countryName' => 'DEU', 'ip' => '127.0.0.1', 'terms' => '', ], ]); /** @var \AnyOption\Responses\InsertUser $response */ $response = $client->call($command);
Note: full list of allowed countries you can get using:
$countries = \AnyOption\Dictionaries::countries();
GetFTDUsersByDate
$command = new \AnyOption\Commands\GetFTDUsersByDate([ 'locale' => 'en', 'dateRequest' => date('Y-m-d'), ]); /** @var \AnyOption\Responses\GetFTDUsersByDate $response */ $response = $client->call($command);
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