Introduction
Nexus is under active development. The core actor model, supervision, and persistence APIs are considered stable. Worker-pool and cluster APIs may still evolve.
Nexus is an actor system for PHP 8.5+, bringing the actor model — lightweight concurrent entities communicating through asynchronous message passing — to the PHP ecosystem as a fully typed, composable library.
The problem
PHP has long been treated as a request-response language. Building concurrent systems, fault-tolerant services, or distributed computing pipelines typically means reaching for external queues, cron jobs, and glue code across multiple infrastructure components. This works, but it spreads concurrency concerns across operational tooling rather than expressing them in application code.
Nexus addresses this by giving PHP developers a structured concurrency model where:
- Concurrent workloads are expressed as actors that process messages one at a time, eliminating shared-state bugs by design.
- Fault tolerance is built into the hierarchy: parent actors supervise their children and decide how to handle failures (restart, stop, escalate) without bringing down the entire system.
- Distributed computing becomes possible through location-transparent actor references — the same
ActorRefinterface works whether the actor is local, in another process, or on another machine.
Who Nexus is for
Nexus is designed for PHP teams building:
- Event-driven systems — CQRS/ES architectures, domain event processing, and reactive pipelines.
- Task processing — background job execution with supervision, retries, and backpressure built in.
- Real-time applications — WebSocket servers, chat systems, live dashboards, and notification fanout running on Swoole.
- Long-running services — daemons and workers that must stay up, self-heal, and handle partial failures gracefully.