PHPackages                             nexus-actors/nexus - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. nexus-actors/nexus

ActiveProject[Framework](/categories/framework)

nexus-actors/nexus
==================

Nexus — A production-grade actor system for PHP 8.5+

10[4 PRs](https://github.com/nexus-actors/nexus/pulls)PHPCI passing

Since Feb 22Pushed 2mo agoCompare

[ Source](https://github.com/nexus-actors/nexus)[ Packagist](https://packagist.org/packages/nexus-actors/nexus)[ RSS](/packages/nexus-actors-nexus/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (17)Used By (0)

Nexus
=====

[](#nexus)

An actor system for PHP 8.5+. Type-safe actors, supervision trees, event sourcing, and multi-worker scaling — Akka and OTP patterns in the PHP you already know.

Why Nexus?
----------

[](#why-nexus)

PHP has mature tools for HTTP request handling, but nothing serious for building concurrent, long-running systems. When you need actors, supervision, or message-driven architectures, the answer has always been "use a different language." Nexus changes that.

**The problem.** Building concurrent PHP systems today means stitching together queue workers, process managers, and ad-hoc error recovery. There's no structured way to manage state across concurrent units, no supervision hierarchy to handle failures automatically, and no type safety for the messages flowing through your system.

**The approach.** Nexus brings battle-tested patterns from Akka and OTP to PHP with zero compromises on type safety. Every `ActorRef` is generic — Psalm catches message type mismatches at analysis time, not in production. Behaviors are immutable value objects. State is explicitly managed, never shared. The entire API is `readonly` and `final` by default.

**What makes it different:**

- **Two runtimes, one API.** Write actor code once. Run it on PHP Fibers during development and Swoole coroutines in production. Actors have no runtime dependency.
- **Supervision that actually works.** Actors form a hierarchy. Parents supervise children. When something fails, the supervision strategy decides what happens — restart, stop, escalate, or back off exponentially. No try/catch pyramids.
- **PHP 8.5+ native.** Nexus uses `readonly class`, typed class constants, and generic templates throughout. Built for modern PHP, not retrofitted onto it.
- **PSR everywhere.** PSR-11 containers, PSR-3 logging, PSR-14 event dispatching, PSR-20 clocks. Nexus plugs into your existing stack.
- **Multi-worker scaling.** Scale actors across all CPU cores on a single machine via Swoole's `Thread\Pool`. Each worker runs an independent `ActorSystem`. `WorkerActorRef` delivers messages cross-thread via `Thread\Queue` at 260K msgs/sec — no application-level serializer required.

Quick Example
-------------

[](#quick-example)

Two actors communicating with immutable messages using the Fiber runtime:

```
