Releases: fcsapi/websocket-php
Releases · fcsapi/websocket-php
4.0.0
FCS WebSocket PHP v4.0.0
First Release - PHP WebSocket client for real-time Forex, Crypto, and Stock market data streaming from FCS API.
What's New
Initial release with complete WebSocket implementation:
- Real-time Streaming - Live price updates via WebSocket (1-5 second updates)
- Multi-Market Support - Forex (FX:EURUSD), Crypto (BINANCE:BTCUSDT), Stocks (NASDAQ:AAPL)
- OHLCV Data - Open, High, Low, Close, Volume with Ask/Bid prices
- Auto-Reconnect - Automatic reconnection on connection drops (configurable retry limit)
- Tab Visibility - Smart disconnect when browser tab is hidden (saves bandwidth)
- Heartbeat Mechanism - Built-in WebSocket keep-alive
- CDN Support - JavaScript library available via CDN or local file
Installation
Composer:
composer require fcsapi/websocket-phpManual:
<script src="https://cdn.jsdelivr.net/gh/fcsapi/websocket-php/fcs-client-lib.js"></script>Quick Start
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/gh/fcsapi/websocket-php/fcs-client-lib.js"></script>
</head>
<body>
<div id="price">Loading...</div>
<script>
const client = new FCSClient('YOUR_API_KEY');
client.onmessage = (data) => {
if (data.type === 'price' && data.prices) {
document.getElementById('price').innerText =
`${data.symbol}: $${data.prices.c}`;
}
};
client.connect().then(() => {
client.join('BINANCE:BTCUSDT', '1D');
});
</script>
</body>
</html>Examples Included
forex-example.php- Real-time Forex prices (EUR/USD, GBP/USD)crypto-example.php- Cryptocurrency prices (Bitcoin, Ethereum)stock-example.php- Stock prices (AAPL, TSLA, GOOGL)- Laravel Blade integration example
- CodeIgniter framework example
Supported Markets
- Forex: FX:EURUSD, FX:GBPUSD, FX:USDJPY, etc.
- Crypto: BINANCE:BTCUSDT, BINANCE:ETHUSDT, etc.
- Stocks: NASDAQ:AAPL, NYSE:TSLA, etc.
Timeframes
1m, 5m, 15m, 30m, 1h, 4h, 1D, 1W, 1M
Demo Access
Test without signup using demo key: fcs_socket_demo
Requirements
- PHP 7.4 or higher
- Modern browser with WebSocket support
Documentation
- Full docs: https://fcsapi.com/document/stock-api#websocket
- GitHub: https://github.com/fcsapi/websocket-php
- Support: support@fcsapi.com
Get API Key
Sign up for free at https://fcsapi.com