Why Workerman Redefines PHP Backend Performance for Real‑Time Apps

Workerman is an open‑source, high‑performance pure‑PHP application container that breaks traditional PHP limits, supporting TCP, UDP, WebSocket, HTTP, and custom protocols, while the article also lists its recent changelog updates and welcomes several new contributors.

Open Source Tech Hub
Open Source Tech Hub
Open Source Tech Hub
Why Workerman Redefines PHP Backend Performance for Real‑Time Apps

Overview

Workerman is an open‑source, high‑performance PHP application container that extends PHP beyond traditional web page generation. It is a low‑level, generic service framework rather than an MVC framework, allowing developers to build TCP/UDP proxies, ladder proxies, game servers, mail servers, FTP servers, and even PHP implementations of services such as Redis, databases, Nginx, and php‑fpm.

Internally Workerman uses a multi‑process model combined with epoll (on Linux) and non‑blocking I/O. Each worker process can maintain tens of thousands of concurrent connections while running in memory without Apache, Nginx, or php‑fpm. Supported transport layers include TCP, UDP, UNIX sockets, long‑living connections, WebSocket, HTTP, HTTPS, WSS and custom protocols. The framework also provides timers, asynchronous socket clients, async Redis, async HTTP, async message queues and other high‑performance components.

Key Features

Multi‑process architecture with optional worker count configuration.

Event‑driven, epoll‑based I/O for Linux; fallback to select/poll on other platforms.

Built‑in support for TCP, UDP, UNIX socket, WebSocket, HTTP/HTTPS and custom protocols.

Asynchronous clients for Redis, HTTP, and generic sockets.

Timer and task scheduling utilities.

Ability to run as a daemon, reload workers gracefully, and handle signals.

Typical Usage

To start a simple TCP server:

<?php
require __DIR__.'/vendor/autoload.php';
use Workerman\Worker;

$worker = new Worker('tcp://0.0.0.0:1234'); // listen on port 1234
$worker->onMessage = function($connection, $data) {
    $connection->send('You said: '.$data);
};

Worker::runAll();

For a WebSocket server, replace the protocol with websocket:// and handle onConnect, onMessage, and onClose callbacks accordingly.

Update Log (selected recent changes)

Improved test suite for Windows and macOS (#951).

Graceful shutdown and code‑style standardisation (#952).

Fixed onWorkerStop event not being triggered (#959).

Added first‑class callable syntax for event handlers (#972).

Refactored Event.php and enhanced type definitions (#965, #975).

Introduced $outputStream property for configurable output streams (#984).

Fixed STDOUT/STDERR closure in resetStd (#986).

Allowed logFile to be set to /dev/null for silent workers (#993).

Added application/wasm MIME type support (#1032).

Implemented response construction using property promotion (#1050) and added attribute promotion support (#1049).

Compatibility fixes for PHP 8.4, including explicit null handling (#1047).

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PHPNetworkingWorkermanhigh-performance
Open Source Tech Hub
Written by

Open Source Tech Hub

Sharing cutting-edge internet technologies and practical AI resources.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.