Skip to content

v1.1.4

Choose a tag to compare

@tigusigalpa tigusigalpa released this 18 Jan 04:49
· 27 commits to main since this release

Release Notes

v1.1.4 - 2026-01-18

🎉 Major Updates

This release brings significant enhancements to the Bybit PHP SDK, including comprehensive REST API coverage, WebSocket support, and extensive documentation improvements.

✨ New Features

REST API Methods

  • Order Management

    • amendOrder() - Modify existing orders (price, quantity)
    • cancelAllOrders() - Cancel all orders for a specific symbol
    • getHistoryOrders() - Retrieve closed/cancelled order history
  • Position Management

    • switchPositionMode() - Switch between One-Way Mode and Hedge Mode
    • setTradingStop() - Set Take Profit and Stop Loss for existing positions

WebSocket Real-Time Streaming

  • New BybitWebSocket Class - Complete WebSocket client implementation

    • Public streams: orderbook, trades, tickers, klines
    • Private streams: positions, orders, executions, wallet updates
    • Auto-reconnection handling
    • Automatic ping/pong for connection maintenance
    • Support for multiple topic subscriptions
    • Regional endpoint support
    • Testnet compatibility
  • Laravel Integration

    • BybitWebSocket facade for easy access
    • Service provider registration
    • Background processing support

Helper Methods

  • subscribeOrderbook($symbol, $depth) - Subscribe to orderbook updates
  • subscribeTrade($symbol) - Subscribe to public trades
  • subscribeTicker($symbol) - Subscribe to ticker updates
  • subscribeKline($symbol, $interval) - Subscribe to kline/candlestick data
  • subscribePosition() - Subscribe to position updates (private)
  • subscribeOrder() - Subscribe to order updates (private)
  • subscribeExecution() - Subscribe to execution updates (private)
  • subscribeWallet() - Subscribe to wallet updates (private)

📚 Documentation Improvements

Modern README Design

  • Enhanced Visual Design

    • Added badges (PHP version, Laravel compatibility, License, WebSocket support)
    • Centered header with professional styling
    • Interactive table of contents with anchor links
    • Emoji icons for better readability
    • Two-column feature tables
  • Comprehensive Table of Contents

    • Quick navigation to all sections
    • Organized by feature categories
    • Easy-to-scan structure
  • Pure PHP Examples

    • Complete standalone examples without Laravel
    • WebSocket usage for pure PHP
    • Full initialization examples
    • Trading bot example
  • Enhanced Sections

    • Regional endpoints table with country flags
    • Configuration parameters table
    • Advanced usage examples
    • Complete trading bot example
    • Contributing guidelines
    • Professional footer with call-to-action

Bilingual Documentation

  • English (README.md) - Fully modernized with all new features
  • Russian (README-ru.md) - Complete translation with identical structure

New Documentation Files

  • INSTALLATION.md - Comprehensive installation and setup guide
    • Prerequisites and requirements
    • Step-by-step installation
    • Configuration instructions
    • API key setup
    • Troubleshooting section

📁 Examples Directory

Added complete examples/ folder with 12+ practical examples:

Basic Examples

  • 01-basic-client.php - Client initialization and connection testing
  • 02-market-data.php - Fetching tickers, orderbook, and klines
  • 03-account-info.php - Account balance and fee information

Order Management

  • 04-place-order.php - Placing limit, market, and conditional orders
  • 05-manage-orders.php - Getting, amending, and canceling orders

Position Management

  • 07-positions.php - Viewing and monitoring positions
  • 08-leverage.php - Setting leverage and position modes
  • 09-trading-stops.php - Managing Take Profit and Stop Loss

WebSocket Examples

  • 10-websocket-public.php - Public stream subscriptions
  • 11-websocket-private.php - Private account updates
  • 12-websocket-advanced.php - Advanced multi-symbol monitoring

Laravel Examples

  • laravel/TradingController.php - Controller with DI and facades
  • laravel/BybitWebSocketCommand.php - Artisan command for WebSocket
  • laravel/routes.example.php - API route examples

Configuration

  • config.example.php - Example configuration template
  • README.md - Examples documentation

🔧 Infrastructure

  • .gitignore - Added comprehensive gitignore file
    • Vendor directory exclusion
    • IDE files (VSCode, PHPStorm)
    • Environment files
    • Build artifacts
    • Logs and cache
    • Example configuration files

📦 Dependencies

  • Added: textalk/websocket: ^1.6 - WebSocket client library for real-time streaming

🔄 Updated Files

  • composer.json - Added WebSocket dependency and facade alias
  • src/BybitServiceProvider.php - Registered WebSocket client
  • src/BybitClient.php - Added new REST API methods
  • CHANGELOG.md - Updated with v0.2.0 changes

📖 API Coverage

The SDK now covers the following Bybit V5 API endpoints:

Market Data:

  • ✅ Server Time
  • ✅ Tickers
  • ✅ Orderbook
  • ✅ Klines
  • ✅ Risk Limit

Trading:

  • ✅ Place Order
  • ✅ Amend Order
  • ✅ Cancel Order
  • ✅ Cancel All Orders
  • ✅ Get Open Orders
  • ✅ Get Order History

Position:

  • ✅ Get Positions
  • ✅ Set Leverage
  • ✅ Switch Position Mode
  • ✅ Set Trading Stop

Account:

  • ✅ Get Wallet Balance
  • ✅ Get Fee Rate

WebSocket:

  • ✅ Public: Orderbook, Trade, Ticker, Kline
  • ✅ Private: Position, Order, Execution, Wallet

🎯 Usage Highlights

Quick Start with WebSocket

use Tigusigalpa\ByBit\BybitWebSocket;

$ws = new BybitWebSocket(
    apiKey: null,
    apiSecret: null,
    testnet: false,
    region: 'global',
    isPrivate: false
);

$ws->subscribeOrderbook('BTCUSDT', 50);
$ws->subscribeTrade('BTCUSDT');

$ws->onMessage(function($data) {
    print_r($data);
});

$ws->listen();

Laravel WebSocket Command

php artisan bybit:listen BTCUSDT

🔗 Links

🙏 Acknowledgments

Special thanks to the Bybit team for their comprehensive API documentation and to the crypto trading community for their feedback and support.

📝 Notes

  • All WebSocket streams support both Testnet and Mainnet environments
  • Regional endpoints are fully supported for both REST and WebSocket
  • Examples include comprehensive error handling
  • All code follows PSR-12 coding standards

⚠️ Breaking Changes

None. This release is fully backward compatible with v0.1.0.

🐛 Bug Fixes

  • Improved error handling in WebSocket connections
  • Fixed signature generation for edge cases
  • Enhanced timestamp synchronization

🔜 Coming Soon

  • Retry mechanisms for failed requests
  • Rate limit handling
  • Request logging and tracing
  • Additional helper methods for common trading patterns

Full Changelog: v0.1.0...v1.1.4