PHPackages                             victorycodedev/metaapi-cloud-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. victorycodedev/metaapi-cloud-php-sdk

ActiveLibrary

victorycodedev/metaapi-cloud-php-sdk
====================================

PHP SDK for MetaApi, a professional cloud forex API

1.0.0(3y ago)10147↓100%1MITPHPPHP ^8.1|^8.2

Since Apr 6Pushed 3y ago1 watchersCompare

[ Source](https://github.com/victorycodedev/metaapi-cloud-php-sdk)[ Packagist](https://packagist.org/packages/victorycodedev/metaapi-cloud-php-sdk)[ Docs](https://github.com/victorycodedev/metaapi-cloud-php-sdk)[ RSS](/packages/victorycodedev-metaapi-cloud-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Metaapi PHP sdk
===============

[](#metaapi-php-sdk)

A PHP Package that let you seamlessly perform api call to Metapapi NOTE: This package does not include all api calls in Metapi. You can do CopyTrade, Account Managment and Metrics.

Installation
------------

[](#installation)

To install the SDK in your project you need to install the package via composer:

```
composer require victorycodedev/metaapi-cloud-php-sdk
```

Usage
-----

[](#usage)

Account Management
------------------

[](#account-management)

You can create an instance of the SDK like so for Account Management:

```
use Victorycodedev\MetaapiCloudPhpSdk\AccountApi;

$account = new AccountApi('AUTH_TOKEN');
```

All methods throws exceptions when the request is not successful, so be sure to put your code in a try and catch block.

```
 when statusCode >= 200 && statusCode < 300;
```

You can add a trading account and starts a cloud API server for the trading account like so:

```
try {
    return $account->create([
        "login" => "123456",
        "password" => "password",
        "name" => "testAccount",
        "server" => "ICMarketsSC-Demo",
        "platform" => "mt5",
        "magic" => 123456
    ]);
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

if the request was successful , you will get the the account id and state, else an Exception will be thrown

```
    [
        "id" => "1eda642a-a9a3-457c-99af-3bc5e8d5c4c9",
        "state" => "DEPLOYED"
    ]
```

You can read an account by the id

```
try {
     return $account->readById("1eda642a-a9a3-457c-99af-3bc5e8d5c4c9");
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

You can read all trading accounts in your metaapi account

```
try {
    return $account->readAll();
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

You can update an account

```
try {
    return  $account->update("1eda642a-a9a3-457c-99af-3bc5e8d5c4c9",[
        "password" => "password",
        "name" => "testAccount",
        "server" => "ICMarketsSC-Demo",
    ]);
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

Undeploy an account

```
try {
    return $account->unDeploy("1eda642a-a9a3-457c-99af-3bc5e8d5c4c9");
    // you can pass other parameters
    return $account->unDeploy("1eda642a-a9a3-457c-99af-3bc5e8d5c4c9", false);
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

Deploy an account

```
try {
    return $account->deploy("1eda642a-a9a3-457c-99af-3bc5e8d5c4c9");
     // you can pass other parameters
    return $account->deploy("1eda642a-a9a3-457c-99af-3bc5e8d5c4c9", false);
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

Redeploy an account

```
try {
    return $account->reDeploy("1eda642a-a9a3-457c-99af-3bc5e8d5c4c9");
     // you can pass other parameters
    return $account->reDeploy("1eda642a-a9a3-457c-99af-3bc5e8d5c4c9", false);
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

Delete an account

```
try {
    return $account->delete("1eda642a-a9a3-457c-99af-3bc5e8d5c4c9");
     // you can pass other parameters
    return $account->delete("1eda642a-a9a3-457c-99af-3bc5e8d5c4c9", true);
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

CopyFactory
-----------

[](#copyfactory)

You can create an instance of the SDK like so for Copyfactory:

```
use Victorycodedev\MetaapiCloudPhpSdk\CopyFactory;

$copyfactory = new CopyFactory('AUTH_TOKEN');
```

To generate a strategy id

```
try {
   return $copyfactory->generateStrategyId();
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

To get all your strategies

```
try {
   return $copyfactory->strategies();
    //you can also pass in other parameters like so
    return $copyfactory->strategies(includeRemoved: true, limit: 1000, offset: 0 );
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

To get a single strategy

```
try {
   return $copyfactory->strategy("strategid");
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

To update a strategy

```
try {
   return $copyfactory->updateStrategy("strategid", [
        "name" => "Test strategy",
        "description" => "Some useful description about your strategy",
        "accountId" => "105646d8-8c97-4d4d-9b74-413bd66cd4ed"
   ]);
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

To remove a strategy

```
try {
   return $copyfactory->removeStrategy("strategid");
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

To get all your subscribers

```
try {
   return $copyfactory->subscribers();
    //you can also pass in other parameters like so
    return $copyfactory->subscribers(includeRemoved: true, limit: 1000, offset: 0 );
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

To get a subscriber

```
try {
   return $copyfactory->subscriber("subscriberiId");
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

To update a subscriber data

```
try {
   return $copyfactory->updateSubscriber("subsciberId", [
        'name' => "Copy Trade Subscriber",
        'subscriptions' => [
            [
                'strategyId' => 'dJZq',
                'multiplier' => 1,
            ]
        ]
    ]);
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

To remove a subscriber

```
try {
   return $copyfactory->removeSubscriber("subsciberId");
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

To delete a subscription

```
try {
   return $copyfactory->deleteSubscription("subsciberId", "strategyId");
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

Copy Trade
----------

[](#copy-trade)

To Copy a trade from provider to subscriber. I recommend you create a strategy before hand and save to your database before you perform a copy trade, but its not compulsory as the package will create one for you. You can always read all your strategies in your account with the " $copyfactory-&gt;strategies()".

To Copy trade do:

```
try {
    $strategyId = "yd24";
    $providerAccountId = "Enter your provider account ID";
    $subAccountId = "Enter Subscriber Account ID";

    return $copyfactory->copy($providerAccountId, $subAccountId, $strategyId);

    /*
    * You can ommit the strategy Id and just copy the trade
    * The package will create a strategy as part of the copy process.
    */

    return $copyfactory->copy($providerAccountId, $subAccountId);

} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

Note: copying a trade will take some seconds to finish, you you can have a loading indicator as feedback.

MetaStats
---------

[](#metastats)

You can get metrics for you account

You can create an instance of the SDK like so for MetaStats:

```
use Victorycodedev\MetaapiCloudPhpSdk\MetaStats;

$stats = new MetaStats('AUTH_TOKEN');
```

To get metrics:

```
try {
   return  $stats->metrics("accountId");
    //  You can pass a boolean as second parameter if you want to include open positions in your metrics
     return  $stats->metrics("accountId", true);
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

To get open trades for MetaApi account:

```
try {
   return  $stats->openTrades("accountId");
} catch (\Throwable $th) {
    $response = json_decode($th->getMessage());
    return $response->message;
}
```

Testing
-------

[](#testing)

```
composer test
```

API Reference
-------------

[](#api-reference)

All API references can be found on Metaapi documentation website.

Security
--------

[](#security)

If you discover any security related issues, please open an issue.

Contributing
------------

[](#contributing)

Pull requests are welcome.

How can I thank you?
--------------------

[](#how-can-i-thank-you)

Why not star the github repo? I'd love the attention! you can share the link for this repository on Twitter or HackerNews?

Don't forget to [follow me on twitter!](https://twitter.com/EfekpoguaVicto4)

Thanks! Efekpogua Victory.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](./LICENSE.md) or more information.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1128d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a9121c2abdf0dfbe4cad781dbfd14ac38b274fb12b1e247825c2c36f54739c2?d=identicon)[victorycodedev](/maintainers/victorycodedev)

---

Top Contributors

[![victorycodedev](https://avatars.githubusercontent.com/u/45511695?v=4)](https://github.com/victorycodedev "victorycodedev (50 commits)")

---

Tags

MetaApiphp-metaapi-sdkvictorycodedev

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/victorycodedev-metaapi-cloud-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/victorycodedev-metaapi-cloud-php-sdk/health.svg)](https://phpackages.com/packages/victorycodedev-metaapi-cloud-php-sdk)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k20](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
