Build a real-time chat server in PHP that handles thousands of users connected simultaneously via WebSocket.
Create a high-performance HTTP API server in PHP that stays running as a long-lived process instead of restarting per request.
Run multiple parallel database or API calls in PHP using coroutines and collect all results before sending a response.
Requires the POSIX and PCNTL PHP extensions, coroutine support additionally needs Swoole or Swow extensions installed.
Workerman is a PHP framework for building network servers that can handle a large number of simultaneous connections. Most PHP applications run through a web server like Apache or Nginx, which spins up a new process for each incoming request. Workerman takes a different approach: it runs as a long-lived process that listens on a port and handles connections through an event loop, similar to how Node.js works. This allows it to maintain thousands of open connections at once without the overhead of starting a new process for each one. The framework supports HTTP servers, WebSocket servers (used for real-time communication like chat or live updates), and raw TCP connections. You write a PHP class that defines what happens when a connection opens, when data arrives, and when a connection closes. Workerman calls these functions at the right time. Adding SSL encryption requires passing a certificate path and setting a transport flag. Setting up a simple WebSocket server takes about 20 lines of code. More advanced features include coroutines, which let PHP wait for slow operations like network calls or database queries without blocking other connections from being served. Coroutines require either the Swoole or Swow PHP extension, or a compatible event loop library. The framework also provides Barrier and Parallel utilities for running multiple tasks at the same time and waiting for all of them to finish before sending a response. Workerman can spawn multiple worker processes to spread load across CPU cores, configured with a single property on the worker object. It is installed via Composer, PHP's package manager, and runs on Linux, macOS, and BSD systems. It requires the POSIX and PCNTL PHP extensions. Full documentation is available at manual.workerman.net.
← walkor on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.