ScriptsMay 19, 2026·2 min read

Workerman — High-Performance Async PHP Socket Framework

Workerman is a pure PHP asynchronous event-driven socket framework for building TCP, UDP, HTTP, and WebSocket servers without any C extensions.

Agent ready

This asset can be read and installed directly by agents

TokRepo exposes a universal CLI command, install contract, metadata JSON, adapter-aware plan, and raw content links so agents can judge fit, risk, and next actions.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
Workerman Overview
Universal CLI install command
npx tokrepo install c09ce3ad-53c0-11f1-9bc6-00163e2b0d79

Introduction

Workerman enables PHP developers to build long-running network services using pure PHP, no C extensions required. It supports millions of concurrent connections and is commonly used for real-time chat, push notifications, and IoT gateways.

What Workerman Does

  • Runs persistent PHP processes for high-performance network services
  • Supports TCP, UDP, HTTP, and WebSocket protocols natively
  • Handles high concurrency through event-driven non-blocking I/O
  • Provides timer, signal handling, and process management APIs
  • Works as a foundation for real-time applications and microservices

Architecture Overview

Workerman uses a multi-process model with a master process that forks worker processes. Each worker runs an event loop (using libevent, event, or a built-in select fallback) that handles socket I/O without blocking. Connections are distributed across workers by the OS kernel, and each worker can handle thousands of simultaneous connections.

Self-Hosting & Configuration

  • Install via Composer with composer require workerman/workerman
  • Start workers with php start.php start (use -d for daemon mode)
  • Configure worker count with $worker->count = 4
  • Set transport to SSL/TLS for encrypted connections
  • Monitor processes with php start.php status

Key Features

  • Zero C extension dependencies for basic usage
  • Multi-process architecture with graceful reload
  • Built-in HTTP and WebSocket server implementations
  • Custom protocol support via simple interfaces
  • Compatible with standard PHP libraries and Composer packages

Comparison with Similar Tools

  • Swoole — C extension with coroutines; Workerman is pure PHP with event-driven callbacks
  • ReactPHP — similar event-loop model; Workerman adds multi-process management built in
  • Node.js — JavaScript event-driven runtime; Workerman offers the same model for PHP teams
  • RoadRunner — Go-based process manager; Workerman stays fully within the PHP ecosystem
  • Amphp — async PHP library; Workerman focuses on network server use cases specifically

FAQ

Q: Does Workerman require the Swoole extension? A: No. Workerman is pure PHP. It optionally uses the event or libevent extensions for better performance.

Q: Can Workerman run alongside PHP-FPM? A: Yes. Workerman runs as a separate process and can coexist with PHP-FPM on the same server.

Q: How many connections can Workerman handle? A: Workerman has been benchmarked handling over one million concurrent connections on a single server with appropriate OS tuning.

Q: Is Workerman suitable for production use? A: Yes. It is widely used in production for chat systems, game servers, and IoT platforms, particularly in the Chinese PHP ecosystem.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets