Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsMay 19, 2026·2 min de lecture

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.

Prêt pour agents

Cet actif peut être lu et installé directement par les agents

TokRepo expose une commande CLI universelle, un contrat d'installation, le metadata JSON, un plan selon l'adaptateur et le contenu raw pour aider les agents à juger l'adaptation, le risque et les prochaines actions.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Workerman Overview
Commande CLI universelle
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

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires