whitebit-exchange / php-sdk
Official PHP SDK for the WhiteBIT cryptocurrency exchange API
1.0.3
2026-11-03 09:35 UTC
Requires
- php: ^8.1
- ext-json: *
- php-http/discovery: ^1.0
- php-http/multipart-stream-builder: ^1.0
- psr/http-client: ^1.0
- psr/http-client-implementation: ^1.0
- psr/http-factory: ^1.0
- psr/http-factory-implementation: ^1.0
- psr/http-message: ^1.1 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: 3.5.0
- guzzlehttp/guzzle: ^7.4
- phpstan/phpstan: ^1.12
- phpunit/phpunit: ^9.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Official PHP SDK for the WhiteBit API — trade, query, and manage your crypto portfolio programmatically.
Prerequisites
| Requirement | Details |
|---|---|
| PHP ≥ 8.1 | Required runtime |
| WhiteBit account | Sign up at whitebit.com |
| WhiteBit API key | Profile → API keys → Create key (Read and/or Trade permissions) |
Installation
composer require whitebit-exchange/php-sdk
Quick Start
1. Get your API credentials
- Log in to whitebit.com → Profile → API keys
- Create a new key — choose Read and/or Trade permissions as needed
- Copy your API Key and Token
Public endpoints (market data, tickers, order book) work without credentials. Private endpoints (account, trading) require both.
2. Initialize the client
Public endpoints only (market data, tickers, order book):
use Whitebit\WhitebitClient; $client = new WhitebitClient(token: "", txcApikey: "");
Private endpoints (account, trading — requires HMAC signing):
use Whitebit\WhitebitClient; use Whitebit\Auth\HmacClient; $client = new WhitebitClient( token: "", txcApikey: "YOUR_API_KEY", options: ['client' => new HmacClient("YOUR_API_SECRET")], );
Note: WhiteBit private endpoints use HMAC-SHA512 signing (
X-TXC-PAYLOAD+X-TXC-SIGNATURE).HmacClienthandles this automatically — no manual signing needed.
---
## Usage Examples
```php
// Market data (no credentials required)
$tickers = $client->publicApiV4->getMarketActivity();
$depth = $client->publicApiV4->getOrderbook(new GetOrderbookRequest(market: "BTC_USDT"));
// Account
$balance = $client->accountEndpoints->getTradingBalance();
// Spot trading
$order = $client->spotTrading->createLimitOrder(
new CreateLimitOrderRequest(
market: "BTC_USDT", side: "buy", amount: "0.01", price: "95000"
)
);
$client->spotTrading->cancelOrder(
new CancelOrderRequest(market: "BTC_USDT", orderId: $order->orderId)
);
// Main account — transfer & withdraw
$client->transfer->transfer(new TransferRequest(from: "main", to: "spot", ticker: "USDT", amount: "100"));
$client->withdraw->createWithdraw(new CreateWithdrawRequest(ticker: "USDT", amount: "500", address: "0x..."));
Available Modules
| Module | Description |
|---|---|
publicApiV4 |
Tickers, order book, trade history, klines, assets |
spotTrading |
Limit, market, stop-limit, stop-market, bulk orders |
collateralTrading |
Collateral orders, OCO, positions |
accountEndpoints |
Trading balance, open orders, order history |
mainAccount |
Main balances, deposit addresses, fee info |
transfer |
Transfer between main and trade accounts |
withdraw |
Withdrawal requests |
codes |
WhiteBit codes — create, apply, history |
fees |
Trading fees |
subAccount |
Sub-account management |
Resources
| WhiteBIT API Documentation | Official API reference |
| API Platform Overview | REST, WebSocket, authentication, rate limits |
| Use with AI | Use API docs with Claude, Cursor, VS Code via MCP |
| GitHub Repository | Source code |
| Releases | Binaries and changelog |
| Contributing | Development setup and contribution guide |
| Report an Issue | Bug reports and feature requests |
| WhiteBIT Exchange | The exchange |