Releases: tigusigalpa/coinglass-php
Releases · tigusigalpa/coinglass-php
Release list
v1.0.0
coinglass-php v1.0.0
First stable release of coinglass-php — a framework-agnostic PHP SDK for the Coinglass API v4, with first-class Laravel 10–13 support.
Highlights
- Full REST coverage across all six endpoint groups: Futures, Spot, Options, ETF, On-Chain, and Indicators.
- Real-time WebSocket client for liquidation orders, spot/futures trades, and futures ticker snapshots — built on plain PHP streams, no extra WebSocket library required (only
ext-opensslforwss://). - Typed responses — every payload is hydrated into a
CoinGlassDtoorCoinGlassCollection, with the original raw payload always available via$dto->raw/$dto->toArray(). - Laravel-ready out of the box — publishable config, a bound singleton client, dependency injection, and a
CoinGlassfacade.
Features
REST client
- Fluent, grouped API surface:
$client->futures(),->spot(),->options(),->etf(),->onChain(),->indicators(). - PSR-18 swappable HTTP client — Guzzle by default, bring your own if you prefer.
- Automatic retry on HTTP
429with exponential backoff, honoring theRetry-Afterheader when Coinglass sends one. - Flexible field access: property syntax (
$dto->openInterestUsd), array syntax ($dto['openInterestUsd']), or$dto->get('openInterestUsd'). - Configuration via constructor,
CoinGlassConfig::fromEnv(), or Laravel config file.
WebSocket client
- Single multiplexed connection with
subscribe()/unsubscribe()for any number of channels. - Automatic
"ping"heartbeat handling. - Both a blocking
listen($callback)loop and aread($timeout)pull model for custom event loops. - Channel helpers:
Channels::liquidationOrders(),spotTrades(),futuresTrades(),futuresTicker(). - Messages hydrate into the same
CoinGlassCollection/CoinGlassDtoused by the REST client.
Error handling
- A focused exception hierarchy —
UnauthorizedException,NotFoundException,RateLimitException,WebSocketException, and a genericApiException, all extendingCoinGlassException. ApiExceptionexposesstatusCode,apiCode, andresponseBody;RateLimitExceptionexposesretryAfter.
Requirements
- PHP 8.1+
- Laravel 10.x–13.x (optional)
- Guzzle
^7.4(default, PSR-18 swappable) ext-opensslfor WebSocketwss://connections
Installation
composer require tigusigalpa/coinglass-phpTesting
Fully covered by unit tests using Guzzle's MockHandler and Orchestra Testbench — the suite runs without ever hitting the live Coinglass API.