PHPackages                             monadial/nexus-monorepo - 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. monadial/nexus-monorepo

ActiveProject[Framework](/categories/framework)

monadial/nexus-monorepo
=======================

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/monadial/nexus-monorepo)[ RSS](/packages/monadial-nexus-monorepo/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (17)Used By (0)

Nexus
=====

[](#nexus)

> **Work in Progress.** Nexus is under active development and not production-ready. APIs may change without notice.

An actor system for PHP 8.5+.

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. You end up reimplementing half of Erlang/OTP, poorly, every time.

**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 at 3 AM. 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. Your actors don't know or care which runtime they're on.
- **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 more try/catch pyramids.
- **PHP 8.5+ native.** Nexus uses `readonly class`, pipe operator support, `#[NoDiscard]`, and generic templates throughout. It's built for modern PHP, not retrofitted onto it.
- **PSR everywhere.** PSR-11 containers for dependency injection. PSR-3 logging. PSR-14 event dispatching. PSR-20 clocks. Nexus plugs into your existing stack.
- **Multi-process scaling.** Scale actors across all CPU cores on a single machine via Swoole's `Process\Pool`. The `ActorRef` interface is the same whether the actor is local or on another worker. Location transparency is baked into the architecture, not bolted on.

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

[](#quick-example)

Two actors communicating with immutable messages using the Fiber runtime:

```
