Download the PHP package yaknet/websocket without Composer
On this page you can find all versions of the php package yaknet/websocket. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package websocket
YakNet WebSocket Component
A zero-dependency, lightweight, high-performance WebSocket Server and Client component for PHP applications. Designed with a non-blocking, multiplexed event-loop (stream_select) architecture, it enables seamless full-duplex real-time communication without external platform runtimes.
Features
- ⚡ Zero External Dependencies: Pure PHP implementation utilizing native PHP streams (
stream_socket_server,stream_socket_client). - 🔄 Event-Driven & Non-Blocking: High-performance single-threaded multiplexing using
stream_select. Handles multiple concurrent clients efficiently. - 🛡️ RFC 6455 Compliant: Complete protocol coverage including el-sıkışma (handshake), fragment buffering, masking/unmasking, and close handshakes.
- 🔌 Built-in Client & Server: Contains both an event-driven Socket Server and a versatile Socket Client.
- 🔒 SSL/TLS Ready: Native support for Secure WebSockets (
wss://) through standard context configurations. - 💓 Automatic Heartbeats: Automated Ping-Pong frame handling, ensuring active connection tracking out of the box.
- 🎛️ Clean Adapter Contract: Interface-driven connection handlers make it trivial to integrate with your existing codebase.
Installation
Add this package to your project using Composer (ensure your local repository mapping is configured):
Quick Start
1. Create a Connection Handler
To process WebSocket events, implement the ConnectionHandlerInterface:
2. Run the WebSocket Server
Instantiate and start the socket listener:
3. Native Secure WebSocket (wss://) Support
Load certificate files into the server configuration:
Using the WebSocket Client
Connect to any WebSocket resource directly from your PHP applications:
Verification & Testing
Verify that your environment supports all WebSocket protocol requirements by running our comprehensive test suite:
Generate type analyses using PHPStan:
License
This project is licensed under the MIT License - see the LICENSE file for details.