PHP code example of victorycodedev / metaapi-cloud-php-sdk

1. Go to this page and download the library: Download victorycodedev/metaapi-cloud-php-sdk 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/ */

    

victorycodedev / metaapi-cloud-php-sdk example snippets


use Victorycodedev\MetaapiCloudPhpSdk\MetaApiClient;
use Victorycodedev\MetaapiCloudPhpSdk\Exceptions\MetaApiException;

$metaapi = new MetaApiClient('AUTH_TOKEN');

try {
    $accounts = $metaapi->accounts()->accounts([
        'limit' => 100,
        'offset' => 0,
    ]);
} catch (MetaApiException $exception) {
    echo $exception->message();
    echo $exception->statusCode();

    print_r($exception->toArray());
}

$accounts = $metaapi->accounts();
$profiles = $metaapi->provisioningProfiles();
$replicas = $metaapi->accountReplicas();
$terminal = $metaapi->terminal(region: 'london');
$copyFactory = $metaapi->copyFactory(region: 'london');
$metaStats = $metaapi->metaStats(region: 'london');
$manager = $metaapi->manager(region: 'london');
$risk = $metaapi->riskManagement(region: 'london');

$manager = $metaapi->manager(
    serverUrl: 'https://mt-manager-api-v1.my-region.example.com'
);

$risk = $metaapi->riskManagement(
    serverUrl: 'https://risk-management-api-v1.my-region.example.com'
);