tigusigalpa/zoomex-php
Composer 安装命令:
composer require tigusigalpa/zoomex-php
包简介
PHP client for Zoomex cryptocurrency exchange API v3. Supports all REST and WebSocket endpoints: market data, trading, positions, account, assets. HMAC_SHA256 authentication, testnet/mainnet support.
README 文档
README
Also available: Zoomex Go Client
PHP/Laravel SDK for Zoomex crypto exchange API v3. Works with REST and WebSocket — market data, trading, positions, account, assets.
What's inside
- Full Zoomex API v3 coverage (REST + WebSocket)
- HMAC-SHA256 request signing
- Laravel support out of the box (service provider, facade, config)
- Testnet/mainnet switching
- PHP 8.1+ with enums and strict types
- Tested with Pest
Requirements
- PHP 8.1+
- Composer
- Laravel 9/10/11/12 (optional)
Installation
composer require tigusigalpa/zoomex-php
Setup
Laravel
php artisan vendor:publish --tag=zoomex-config
.env:
ZOOMEX_API_KEY=your_api_key ZOOMEX_SECRET_KEY=your_secret_key ZOOMEX_TESTNET=false
Standalone PHP
use Tigusigalpa\Zoomex\Client; $client = new Client([ 'api_key' => 'your_api_key', 'secret_key' => 'your_secret_key', 'testnet' => false, ]); // or fluent style $client = Client::make() ->withApiKey('your_api_key') ->withSecretKey('your_secret_key') ->withTestnet(false);
Quick examples
Get tickers
use Tigusigalpa\Zoomex\Facades\Zoomex; use Tigusigalpa\Zoomex\DTO\Market\GetTickersRequest; use Tigusigalpa\Zoomex\Enums\Category; $tickers = Zoomex::market()->getTickers( new GetTickersRequest(category: Category::LINEAR, symbol: 'BTCUSDT') );
Place order
use Tigusigalpa\Zoomex\DTO\Trade\PlaceOrderRequest; use Tigusigalpa\Zoomex\Enums\{Category, OrderSide, OrderType, TimeInForce}; $order = Zoomex::trade()->placeOrder(new PlaceOrderRequest( category: Category::LINEAR, symbol: 'BTCUSDT', side: OrderSide::BUY, orderType: OrderType::LIMIT, qty: '0.01', price: '50000', timeInForce: TimeInForce::GTC ));
Get positions
use Tigusigalpa\Zoomex\DTO\Position\GetPositionInfoRequest; $positions = Zoomex::position()->getPositionInfo( new GetPositionInfoRequest(category: Category::LINEAR, symbol: 'BTCUSDT') );
Get wallet balance
use Tigusigalpa\Zoomex\DTO\Account\GetWalletBalanceRequest; use Tigusigalpa\Zoomex\Enums\AccountType; $balance = Zoomex::account()->getWalletBalance( new GetWalletBalanceRequest(accountType: AccountType::CONTRACT) );
WebSocket — orderbook stream
use Tigusigalpa\Zoomex\WebSocket; $ws = new WebSocket(['api_key' => '...', 'secret_key' => '...']); $ws->subscribeOrderbook('BTCUSDT', 50, function ($data) { print_r($data); }); $ws->run();
WebSocket — private order updates
$ws->subscribePrivateOrders(function ($data) { print_r($data); });
API Reference
Market (public)
| Method | Endpoint | Description |
|---|---|---|
getServerTime() |
/cloud/trade/v3/market/time |
Get server time |
getKline() |
/cloud/trade/v3/market/kline |
Get kline data |
getMarkPriceKline() |
/cloud/trade/v3/market/mark-price-kline |
Get mark price kline |
getIndexPriceKline() |
/cloud/trade/v3/market/index-price-kline |
Get index price kline |
getPremiumIndexPriceKline() |
/cloud/trade/v3/market/premium-index-price-kline |
Get premium index price kline |
getInstrumentsInfo() |
/cloud/trade/v3/market/instruments-info |
Get instruments info |
getOrderbook() |
/cloud/trade/v3/market/orderbook |
Get orderbook |
getTickers() |
/cloud/trade/v3/market/tickers |
Get tickers |
getFundingRateHistory() |
/cloud/trade/v3/market/funding/history |
Get funding rate history |
getPublicTradingHistory() |
/cloud/trade/v3/market/recent-trade |
Get public trading history |
getRiskLimit() |
/cloud/trade/v3/market/risk-limit/info |
Get risk limit |
Trade (private)
| Method | Endpoint | Description |
|---|---|---|
placeOrder() |
/cloud/trade/v3/order/create |
Place order |
amendOrder() |
/cloud/trade/v3/order/amend |
Amend order |
cancelOrder() |
/cloud/trade/v3/order/cancel |
Cancel order |
getOpenOrders() |
/cloud/trade/v3/order/realtime |
Get open orders |
cancelAllOrders() |
/cloud/trade/v3/order/cancel-all |
Cancel all orders |
getOrderHistory() |
/cloud/trade/v3/order/history |
Get order history |
getTradeHistory() |
/cloud/trade/v3/execution/list |
Get trade history |
Position (private)
| Method | Endpoint | Description |
|---|---|---|
getPositionInfo() |
/cloud/trade/v3/position/list |
Get position info |
setLeverage() |
/cloud/trade/v3/position/set-leverage |
Set leverage |
switchIsolated() |
/cloud/trade/v3/position/switch-isolated |
Switch cross/isolated margin |
setTpSlMode() |
/cloud/trade/v3/position/set-tpsl-mode |
Set TP/SL mode |
switchPositionMode() |
/cloud/trade/v3/position/switch-mode |
Switch position mode |
setRiskLimit() |
/cloud/trade/v3/position/set-risk-limit |
Confirm new risk limit |
setTradingStop() |
/cloud/trade/v3/position/trading-stop |
Set trading stop |
setAutoAddMargin() |
/cloud/trade/v3/position/set-auto-add-margin |
Set auto add margin |
addOrReduceMargin() |
/cloud/trade/v3/position/add-margin |
Add or reduce margin |
getClosedPnl() |
/cloud/trade/v3/position/closed-pnl |
Get closed PnL |
Account (private)
| Method | Endpoint | Description |
|---|---|---|
getWalletBalance() |
/cloud/trade/v3/account/wallet-balance |
Get wallet balance |
getFeeRate() |
/cloud/trade/v3/account/fee-rate |
Get fee rate |
getAccountInfo() |
/cloud/trade/v3/account/info |
Get account info |
Asset (private)
| Method | Endpoint | Description |
|---|---|---|
getCoinExchangeRecords() |
/cloud/trade/v3/asset/coin-exchange-record |
Get coin exchange records |
getDeliveryRecord() |
/cloud/trade/v3/asset/delivery-record |
Get delivery record |
getSettlementRecord() |
/cloud/trade/v3/asset/settlement-record |
Get settlement record |
getAssetInfo() |
/cloud/trade/v3/asset/info |
Get asset info |
getAllCoinsBalance() |
/cloud/trade/v3/asset/all-coins-balance |
Get all coins balance |
getInternalTransferRecords() |
/cloud/trade/v3/asset/transfer/query-inter-transfer-list |
Get internal transfer records |
getSubUIDList() |
/cloud/trade/v3/asset/transfer/query-sub-member-list |
Get sub UID list |
createInternalTransfer() |
/cloud/trade/v3/asset/transfer/inter-transfer |
Create internal transfer |
getDepositRecords() |
/cloud/trade/v3/asset/deposit/query-record |
Get deposit records |
getWithdrawalRecords() |
/cloud/trade/v3/asset/withdraw/query-record |
Get withdrawal records |
getCoinInfo() |
/cloud/trade/v3/asset/coin/query-info |
Get coin info |
withdraw() |
/cloud/trade/v3/asset/withdraw/create |
Withdraw |
cancelWithdrawal() |
/cloud/trade/v3/asset/withdraw/cancel |
Cancel withdrawal |
WebSocket Topics
| Channel Type | Topic Pattern | Description |
|---|---|---|
| Public | orderbook.{depth}.{symbol} |
Orderbook (depth: 1, 50, 200, 1000) |
| Public | publicTrade.{symbol} |
Public trades |
| Public | tickers.{symbol} |
Ticker |
| Public | kline.{interval}.{symbol} |
Kline |
| Public | liquidation.{symbol} |
All liquidation |
| Private | order |
Order updates |
| Private | position |
Position updates |
| Private | execution |
Execution updates |
| Private | wallet |
Wallet updates |
Errors
Two exception types:
ZoomexApiException— API returned error (retCode !== 0)ZoomexRequestException— HTTP/network failure
use Tigusigalpa\Zoomex\Exceptions\{ZoomexApiException, ZoomexRequestException}; try { $order = Zoomex::trade()->placeOrder($request); } catch (ZoomexApiException $e) { // $e->retCode, $e->retMsg } catch (ZoomexRequestException $e) { // network issue }
Rate limits
See official docs.
Testing
composer test
Contributing
See CONTRIBUTING.md.
Security
Found a vulnerability? Email sovletig@gmail.com (don't open public issues).
Author
Based on zoomex-go.
License
MIT. See LICENSE.
Links
tigusigalpa/zoomex-php 适用场景与选型建议
tigusigalpa/zoomex-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「websocket」 「api」 「crypto」 「laravel」 「exchange」 「trading」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tigusigalpa/zoomex-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tigusigalpa/zoomex-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tigusigalpa/zoomex-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
High-level cryptographic primitives and security utilities for Maatify systems including password hashing, reversible encryption, HKDF key derivation, and key rotation.
WebSocket view engine
This is a PHP Framework base on Swoole
A simple PHP Cryptography Implementation for the Ark Blockchain.
A simple PHP API client for the Ark Blockchain.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-15