Download the PHP package tigusigalpa/phemex-php without Composer
On this page you can find all versions of the php package tigusigalpa/phemex-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tigusigalpa/phemex-php
More information about tigusigalpa/phemex-php
Files in tigusigalpa/phemex-php
Package phemex-php
Short Description A framework-agnostic PHP client for the Phemex cryptocurrency exchange API with first-class Laravel support.
License MIT
Homepage https://github.com/tigusigalpa/phemex-php
Informations about the package phemex-php
Phemex PHP

A typed PHP client for the Phemex exchange API. Drop it into any PHP 8.1+ project, and if you're on Laravel 10–13 it just works — no extra setup.
I got tired of hand-rolling cURL calls, computing HMAC signatures, and bolting on retry logic every time I touched the Phemex API. So this library does all of that for you and hands back a clean, object-oriented interface. You write strategy; it handles the plumbing.
What's in the box
- Runs anywhere. The core is plain PHP 8.1+ built on PSR-18 — no framework required.
- Laravel, out of the box. Auto-discovered service provider, publishable config, and a
Phemexfacade. - Signing you don't think about. Private endpoints get HMAC SHA256 signatures automatically, straight from Phemex's own algorithm.
- Your HTTP client, your rules. Guzzle ships by default, but swap in any PSR-18 implementation you like.
- Responses that won't break. Return values are DTOs that keep the raw payload around, so when Phemex adds a field, you can still reach it.
- Retries handled for you. Rate limits (HTTP 429) and flaky server errors are retried with exponential backoff.
- Exceptions that make sense.
AuthenticationException,RateLimitException,NotFoundException,ValidationException, andApiException. - Real-time when you need it. Optional WebSocket streams via
ratchet/pawl.
Installation
Laravel
The service provider is auto-discovered, so there's nothing to register. Publish the config file whenever you want to tweak the defaults:
Then set your environment variables:
Configuration
After publishing, config/phemex.php contains:
Prefer your own PSR-18 client — maybe with custom middleware, logging, or metrics? Just bind it in a service provider:
Quick start
Standalone PHP
Laravel Facade
Error handling
Endpoints
Each endpoint group lives behind its own method on the client:
| Group | Client method | Covered endpoints |
|---|---|---|
| Market Data | $client->market() |
products, time, orderBook, fullBook, kline, trades, 24h ticker, 24h all tickers, funding-rate-history |
| Spot Trading | $client->spot() |
create, amend, cancel, cancel-all, open order, open orders, wallets, order history, trade history |
| USDⓈ-M Contracts | $client->usdm() |
create, amend, cancel, bulk cancel, cancel all, open orders, positions, switch pos mode, leverage, assign balance, closed orders, trade history |
| Coin-M Contracts | $client->coinM() |
create, amend, cancel, bulk cancel, cancel all, open orders, account/positions, leverage, risk limit, assign balance |
| Margin Trading | $client->margin() |
create, cancel, cancel all, open order, borrow history, borrow, payback |
| Assets & Transfers | $client->assets() |
transfer, transfer history, universal transfer, deposit address, deposit/withdraw history |
Want to see these in action? Check out the examples/ directory.
WebSocket streams
Need real-time data? Install ratchet/pawl and you're set:
Running the tests
Everything runs against a mocked HTTP client, so you don't need an API key or a network connection to run the suite.
License
MIT. See LICENSE for details.
Built by Igor Sazonov. Spotted a bug or missing an endpoint? Open an issue or send a PR — I'd love the help.
All versions of phemex-php with dependencies
guzzlehttp/guzzle Version ^7.4
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.0 || ^2.0
ext-json Version *