A modern PHP SDK for MetaApi services.
- MetaTrader account management
- Provisioning profiles
- Account replicas
- MT4/MT5 demo accounts
- Expert advisors
- User quota management
- Known trading servers
- MetaApi REST terminal API
- CopyFactory
- MetaStats
- MT Manager API
- Risk Management API
Real-time streaming/WebSocket support is planned for a future version.
- PHP 8.2 or newer
composer require victorycodedev/metaapi-cloud-php-sdkUse MetaApiClient as the main SDK entry point:
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());
}All failed MetaApi responses throw MetaApiException. The exception exposes MetaApi's standard error fields using id(), error(), message(), details() and 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');Account Management uses MetaApi's global provisioning URL and does not require a region. Regional services default to new-york.
For private/custom regions, pass the service URL:
$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'
);- Account Management
- Provisioning Profiles
- Account Replicas
- Demo Accounts, Expert Advisors, Quotas and MT Servers
- MetaApi REST Terminal API
- CopyFactory
- MetaStats
- MT Manager API
- Risk Management API
- Error Handling
- Custom HTTP Client
- Roadmap
composer testAll official API references can be found on the MetaApi documentation website: https://metaapi.cloud/
If you discover any security related issues, please open an issue.
Pull requests are welcome.
Why not star the GitHub repo? You can also share the link for this repository on Twitter or HackerNews.
Follow me on X: https://x.com/efekpoguavik3
Thanks! Efekpogua Victory.
The MIT License (MIT). Please see License File for more information.