Download the PHP package tigusigalpa/bitget-php without Composer
On this page you can find all versions of the php package tigusigalpa/bitget-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tigusigalpa/bitget-php
More information about tigusigalpa/bitget-php
Files in tigusigalpa/bitget-php
Package bitget-php
Short Description A production-grade PHP/Laravel SDK for the Bitget Unified Trading Account (UTA) API v3.
License MIT
Homepage https://github.com/tigusigalpa/bitget-php
Informations about the package bitget-php
Bitget PHP/Laravel Client/SDK/Client

A production-grade PHP SDK for the Bitget Unified Trading Account (UTA) API v3, with seamless Laravel 10-13 integration. Phase 1 covers Market, Account, and Trade REST services plus a reconnecting WebSocket client with a pluggable transport.
Package: a matching Go SDK is available at tigusigalpa/bitget-go.
What's inside
- PHP 8.2+,
declare(strict_types=1)everywhere, readonly constructor properties - Strings for every price/quantity/PnL/fee field — no float rounding errors
- Guzzle-based HTTP transport with an injectable
GuzzleHttp\Clientfor tests/proxies - PSR-3 logging (defaults to a no-op
NullLogger); credentials are never logged - A typed exception hierarchy (
AuthenticationException,RateLimitException,InvalidParameterException,InsufficientFundsException,OrderNotFoundException) carrying Bitget's raw error code - A
WebsocketClientwith pluggable transport (ConnectionInterface) — ships with a synchronoustextalk/websocketadapter; implement the interface yourself to run under ReactPHP, Amp, or Laravel Octane's event loop - Laravel service provider, publishable config, and
Bitgetfacade — auto-discovered, but the SDK has no hardilluminate/*dependency outside Laravel apps
Install
Laravel setup
The service provider and Bitget facade are auto-discovered. Publish the config file:
Plain PHP (no Laravel)
Configuration
config/bitget.php key |
Env var | Default |
|---|---|---|
api_key |
BITGET_API_KEY |
'' |
secret_key |
BITGET_SECRET_KEY |
'' |
passphrase |
BITGET_PASSPHRASE |
'' |
demo |
BITGET_DEMO |
false |
base_url |
BITGET_BASE_URL |
https://api.bitget.com |
locale |
BITGET_LOCALE |
en-US |
REST API coverage (Phase 1)
| Category | Methods | Docs |
|---|---|---|
| Market (public) | getInstruments, getTickers, getOrderBook |
Instruments · Tickers · OrderBook |
| Account (private) | getAssets, getSettings, setLeverage |
Get-Account · Get-Account-Setting · Change-Leverage |
| Trade (private) | placeOrder, modifyOrder, cancelOrder, getOpenOrders, getOrderHistory, getPositions |
Place-Order · Modify-Order · Cancel-Order · Get-Order-Pending · Get-Order-History · Get-Position |
Full mapping with HTTP methods and paths: docs/endpoints.md.
WebSocket
For private channels (e.g. order fills), pass credentials to the constructor — connect() authenticates automatically:
connect() is safe to call repeatedly while the socket is open. subscribe() is idempotent per channel, preventing duplicate subscription frames and unnecessary quota use. listen() blocks the current process, answers Bitget's text-frame ping/pong heartbeat, and — on an unexpected disconnect — reconnects with exponential backoff (1s → 60s cap) and restores every active channel in one subscription frame. The default transport (TextalkConnection) is synchronous; to run under a non-blocking event loop (ReactPHP, Amp, Laravel Octane), implement Tigusigalpa\Bitget\WebSocket\ConnectionInterface and pass it as WebsocketClient's $connection constructor argument.
Implemented private channel: fast-fill. Other channels work through the same subscribe()/listen() API; see docs/endpoints.md.
Demo trading
Set demo: true (or BITGET_DEMO=true) together with a Demo API key from the Bitget console to send paptrading: 1 on every REST request, or use WebsocketClient::DEMO_PUBLIC_URL/DEMO_PRIVATE_URL for WebSocket. Always validate new code against demo credentials before pointing it at a live account:
Errors
Tests
Unit tests run fully offline against a mocked Guzzle transport (MockHandler) — no network access or credentials required.
Contributing
- Fork and branch off
main. - Add/update tests for any behavior change (
vendor/bin/phpunitmust pass). - Every public method must include a
Docs:line in its docblock linking to the exact Bitget API documentation page it implements. - Update docs/endpoints.md for new endpoints.
Security
Found a vulnerability? Email [email protected] directly — please don't open a public issue.
License
MIT. See LICENSE.
Author
Igor Sazonov — @tigusigalpa — [email protected]
Links
Not affiliated with Bitget. Test on demo before going live.
All versions of bitget-php with dependencies
guzzlehttp/guzzle Version ^7.15.2
phrity/websocket Version ^3.7.3
psr/log Version ^3.0