Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Meta Five Laravel Package

aleedhillon/meta-five

A Laravel/PHP package for dynamic SEO metadata. MetaFive provides a simple API for page titles, descriptions, Open Graph and Twitter Card tags, canonical URLs, and robots directives, with Blade integration for managing meta tags in your views.

View on GitHub
Deep Wiki
Context7

Getting Started

The package is a thin Laravel wrapper around the MetaTrader 5 Web API — a separate MetaQuotes product that runs on the Windows machine hosting the MT5 terminal. Before touching composer, confirm you actually have that Web API server reachable (default https://<host>:443), because the package is useless without it. This is the single biggest "gotcha" that people miss: the Laravel package is the client, not the server.

Minimal steps:

composer require aleedhillon/meta-five
php artisan vendor:publish --provider="Aleedhillon\\MetaFive\\MetaFiveServiceProvider"

Then inspect config/meta-five.php in vendor/aleedhillon/meta-five/config/ if the publish tag differs — with 35 stars the README is likely terse, so the config file itself is your source of truth. Expect keys roughly like:

// config/meta-five.php
return [
    'host'     => env('MT5_HOST', '127.0.0.1'),
    'port'     => env('MT5_PORT', 443),
    'login'    => env('MT5_LOGIN'),
    'password' => env('MT5_PASSWORD'),
    'server'   => env('MT5_SERVER'), // broker's server name, e.g. "ICMarkets-Live"
];

First use case — authenticate and confirm you can read the account:

use Aleedhillon\MetaFive\Facades\MetaFive;

MetaFive::connect();
$account = MetaFive::accountInfo();

dump($account['Balance'], $account['Equity'], $account['Currency']);

If connect() succeeds and accountInfo() returns your balance, everything downstream is just calling the right endpoint. Read the package's src/ directory first — the facade proxies to a single client class, and its public methods are the API surface you'll actually be using. Skim src/Facades/, src/MetaFive.php (or similar), and src/Http/ before writing any business logic.

Implementation Patterns

Wrap the client in your own service class. The raw facade leaks MT5 wire-format assumptions (string decimals, server-side timestamps, broker-specific symbol suffixes) directly into your controllers. Put a TradingService or MetaTrader wrapper in app/Services/ so you have one seam to test and one place to translate.

final class TradingService
{
    public function __construct(private MetaFive $client) {}

    public function balance(): float
    {
        return (float) $this->client->accountInfo()['Balance'];
    }

    public function buy(string $symbol, float $volume): array
    {
        return $this->client->trade([
            'action' => 'DEAL',
            'type'   => 'BUY',
            'symbol' => $this->normalizeSymbol($symbol),
            'volume' => number_format($volume, 2, '.', ''),
        ]);
    }
}

Poll on a schedule, not on request. MT5 prices and positions change continuously; hitting the Web API inside a user request will make your app slow and hammer the trading server. Use a scheduled command that writes into Redis or a DB table, and serve reads from your own store.

// app/Console/Kernel.php
$schedule->job(new SyncAccountSnapshot)->everyMinute();
$schedule->job(new SyncOpenPositions)->everyThirtySeconds();

Treat auth as stateful and re-auth on failure. The MT5 Web API uses a challenge/response handshake, and sessions expire. In job handle() methods, catch connection errors and retry after reconnecting rather than assuming a long-lived session:

try {
    $client->connect();
    $client->positions();
} catch (Throwable $e) {
    $client->connect(); // re-handshake
    throw $e;
}

Queue trade executions. Order placement should never happen in an HTTP request. Dispatch a job, return 202 Accepted, and let the job record the result. This also gives you an audit trail — brokers care about timestamps and you'll need them if a trade "didn't go through."

Log every trade payload and response to a dedicated channel. MT5 trades are financial events; if something goes wrong you want the exact request body, not a stack trace.

Use it as the write side of a read-model. For dashboards, keep a local positions and account_snapshots table. The MT5 Web API is for acting on the account, not for serving UI.

Gotchas and Tips

  • The Web API server is not free and not bundled. MetaQuotes licenses it separately, and it must run on a Windows host alongside an MT5 terminal instance. If connect() hangs or times out, that is almost always the cause — not the package.
  • Broker-specific symbol names. EURUSD may be EURUSD.a, EURUSDm, or EURUSD.r. Never hardcode; fetch the symbol list once and cache it, or normalize suffixes in config.
  • Use strings for prices and volumes. The MT5 API returns "Bid": "1.08432" as a string to preserve tick precision. Don't (float) cast before sending a trade — you'll get rejected orders or slippage. number_format($x, $digits, '.', '') is the safe path.
  • Server time vs UTC. Timestamps are in broker server time (often UTC+2/UTC+3 with DST). Convert explicitly and record the offset; otherwise every "when did the trade fill?" question becomes a support ticket.
  • Login/password/server are all case-sensitive and must match the terminal config exactly, including the trailing portion of the server name. A copy-paste mismatch from the terminal's "About" dialog is a common first-day failure.
  • Config caching bites. php artisan config:cache will freeze credentials; run config:clear after editing .env, and be aware that long-running queue workers won't pick up changed env either.
  • Debugging in tinker. php artisan tinker with the facade is the fastest loop before you write jobs: call connect(), then dump raw responses. If the package swallows errors, add a log call around the client in AppServiceProvider::boot() or extend the client class.
  • Don't run against a live account during development. Use a demo broker account with the Web API enabled, or you will accidentally place real trades. Gate live trading with an MT5_LIVE=false env flag and a TradingService::assertNotLive() guard.
  • Extension points are thin. With 35 stars this is a small package — there are no plugins or events to hook into; your extension points are (a) subclassing the client, (b) decorators around the facade, and (c) publishing the config. Plan your wrapper accordingly.
  • Verify the HTTP client contract. Check whether the package uses Guzzle directly or Laravel's Http facade — it affects whether you can mock it in tests via Http::fake() or need a Guzzle mock handler. In feature tests, mock TradingService, not the underlying client.
  • Firewall. Your Laravel host must reach the Web API port on the Windows machine. Whitelist it explicitly; do not tunnel trading traffic through a shared VPN with unpredictable latency.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment