Download the PHP package tigusigalpa/bybit-php without Composer
On this page you can find all versions of the php package tigusigalpa/bybit-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tigusigalpa/bybit-php
More information about tigusigalpa/bybit-php
Files in tigusigalpa/bybit-php
Package bybit-php
Short Description Bybit V5 API client for PHP with Laravel 8-13 integration
License MIT
Informations about the package bybit-php
Bybit PHP/Laravel Client/SDK/Library

V5 API Client for PHP & Laravel
Language: English | Русский
A PHP library for working with the Bybit V5 API. Supports REST and WebSockets, and works both standalone and with Laravel.
Examples
Features
- Core Bybit V5 REST coverage for spot, linear, inverse, options, and the officially supported Demo Trading endpoints
- TradFi support — gold, silver, forex, stock CFDs, and indices via
BybitTradFi - HMAC-SHA256 and RSA-SHA256 signatures
- WebSocket for real-time data (orderbook, trades, klines, account updates)
- Testnet and demo trading support
- Regional endpoints (NL, TR, KZ, GE, AE, EU, ID, JP, HK)
- Laravel integration (facade, service provider, config publishing)
- WebSocket heartbeat, subscription management, and explicit connection lifecycle
Installation
Pure PHP (without Laravel)
Laravel Integration
For local monorepo setup:
-
Add repository to
composer.json: -
Install the package:
- Publish configuration:
Laravel auto-discovery регистрирует service provider и facade автоматически.
Testing
Configuration
Environment Variables
Create or update your .env file:
Configuration Options
| Parameter | Type | Default | Description |
|---|---|---|---|
BYBIT_API_KEY |
string | - | Your Bybit API public key |
BYBIT_API_SECRET |
string | - | Your Bybit API secret key |
BYBIT_TESTNET |
boolean | false |
Enable testnet environment |
BYBIT_DEMO_TRADING |
boolean | false |
Enable demo trading environment |
BYBIT_REGION |
string | global |
Regional endpoint (global, nl, tr, kz, ge, ae, eu, id, jp, hk) |
BYBIT_RECV_WINDOW |
integer | 5000 |
Request receive window (ms) |
BYBIT_SIGNATURE |
string | hmac |
Signature type (hmac or rsa) |
BYBIT_RSA_PRIVATE_KEY |
string | null |
RSA private key (PEM format) |
BYBIT_BROKER_ID |
string | null |
Broker ID sent as X-Referer; leave empty for non-broker keys |
BYBIT_WEBSOCKET_PRIVATE |
boolean | false |
Create the Laravel WebSocket singleton as a private stream |
BYBIT_TESTNET and BYBIT_DEMO_TRADING are mutually exclusive. Demo Trading uses API keys created in a production account's Demo Trading area; Testnet requires Testnet keys.
Quick Start
Pure PHP Usage
The constructor examples below use PHP 8 named arguments. On PHP 7.4, pass the same values positionally.
Laravel Usage
Using Facade:
Using Dependency Injection:
API Methods
Market Data
Order Management
Position Management
Account & Wallet
Demo Trading
Demo Trading is an isolated, limited-function environment at api-demo.bybit.com. Use a production account's Demo Trading API key, never combine it with Testnet, and expect Demo orders to be retained for seven days.
For Demo Trading, REST market endpoints and private WebSocket streams use the demo domain. Public WebSocket market data is identical to mainnet and uses stream.bybit.com; WebSocket order entry is unavailable in Demo Trading.
Laravel Demo Trading:
WebSocket Streaming
Public Streams
Pure PHP WebSocket:
Private Streams
Authenticated WebSocket for account updates:
Laravel Background Command:
Run with: php artisan bybit:listen BTCUSDT
TradFi
The BybitTradFi class provides a dedicated interface for trading traditional financial instruments — gold, silver, forex pairs, stock CFDs, and indices — all available on Bybit as linear perpetuals through the standard V5 API.
Instantiate by passing an existing BybitClient:
Predefined Symbol Lists
Market Data
Trading
Symbol Detection Helper
Note: TradFi instruments follow market hours (unlike 24/7 crypto). Outside trading sessions the API may return empty order books or stale prices. Swap fees apply when holding positions past daily market close — check
getSwapFee()before sizing.
Advanced Usage
Universal Order Placement
Trading Fee Calculation
Regional Endpoints
| Region | Code | Endpoint |
|---|---|---|
| 🌐 Global | global |
https://api.bybit.com |
| 🇳🇱 Netherlands | nl |
https://api.bybit.nl |
| 🇹🇷 Turkey | tr |
https://api.bybit.tr |
| 🇰🇿 Kazakhstan | kz |
https://api.bybit.kz |
| 🇬🇪 Georgia | ge |
https://api.bybitgeorgia.ge |
| 🇦🇪 UAE | ae |
https://api.bybit.ae |
| 🇪🇺 EEA (REST only) | eu |
https://api.bybit.eu |
| 🇮🇩 Indonesia | id |
https://api.bybit.id |
| 🇯🇵 Japan | jp |
https://api.manepa.jp |
| 🇭🇰 Hong Kong | hk |
https://api.spark-fintech.com |
| 🧪 Testnet | - | https://api-testnet.bybit.com |
Authentication
Signature Generation
Bybit V5 API uses HMAC-SHA256 or RSA-SHA256 for request signing:
For GET requests:
For POST requests:
HMAC-SHA256: Returns lowercase hex RSA-SHA256: Returns base64
Required Headers
Official docs: https://bybit-exchange.github.io/docs/v5/guide
Examples
Trading Bot Example
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
MIT License
Copyright (c) 2026 Igor Sazonov
- Author: Igor Sazonov (
tigusigalpa) - Email: [email protected]
- GitHub: https://github.com/tigusigalpa/bybit-php
All versions of bybit-php with dependencies
guzzlehttp/guzzle Version ^7.8
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
textalk/websocket Version ^1.6