PHP code example of resnext / solaris-api-client

1. Go to this page and download the library: Download resnext/solaris-api-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

resnext / solaris-api-client example snippets


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

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

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

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

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

$request = new \Solaris\Requests\GetCustomerAuthKeyRequest(['email' => '[email protected]']);

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

echo $response->getAuthUrl();

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