Download the PHP package ez-php/websocket without Composer
On this page you can find all versions of the php package ez-php/websocket. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ez-php/websocket
More information about ez-php/websocket
Files in ez-php/websocket
Package websocket
Short Description PHP 8.5 Fiber-based WebSocket server for ez-php — RFC 6455 handshake, frame codec, ChannelManager pub/sub, and a non-blocking event loop.
License MIT
Homepage https://github.com/ez-php/websocket
Informations about the package websocket
ez-php/websocket
PHP 8.5 Fiber-based WebSocket server for the ez-php ecosystem.
Implements RFC 6455 from the ground up — no third-party WebSocket library needed. Each connection runs in its own Fiber, allowing hundreds of concurrent clients on a single PHP process without threads or async extensions.
Intentionally separate from ez-php/broadcast (SSE/event-bus); this module
provides bidirectional, low-latency real-time communication.
Installation
No framework integration is needed — the server runs as a standalone long-lived process.
Quick start
Start the server:
Connect from a browser:
Core classes
Server
- Opens a TCP server socket via
stream_socket_server() - Spawns one
Fiberper accepted connection - Non-blocking
stream_select()event loop resumes Fibers when sockets are readable - Handles PING→PONG and CLOSE frames automatically
ConnectionInterface / Connection
Frame
Represents one RFC 6455 frame. Available in HandlerInterface::onMessage():
ChannelManager
Named pub/sub channels over connected clients:
broadcast() silently prunes disconnected connections.
Architecture notes
- No message fragmentation reassembly: continuation frames are silently ignored. Real-world clients send single-frame messages for chat/notifications; large binary transfers should be chunked at the application level.
- No TLS (WSS): terminate TLS at a reverse proxy (nginx, Caddy) and use plain
ws://internally. - No authentication: verify cookies or tokens in
onOpen()and call$conn->close()on failure.
License
MIT