Skip to content
@nexus-actors

Nexus Actors

A typed actor system for PHP 8.5+

Nexus

A typed actor system for PHP 8.5+   v0.1.0

Type-safe actors, supervision trees, event sourcing, TCP clustering.
Erlang/OTP and Akka patterns — in the PHP you already know.

nexusactors.com · Documentation · Quickstart · Monorepo


composer create-project nexus-actors/skeleton my-app
cd my-app
bin/console run

An interactive wizard picks your runtime and modules; make:actor scaffolds handler, functional, stateful, and persistent actors.


// Define messages
readonly class Ping {
    public function __construct(public ActorRef $replyTo) {}
}
readonly class Pong {}

// Define actor behavior
$pongActor = Behavior::receive(
    static fn(ActorContext $ctx, Ping $msg) => $msg->replyTo->tell(new Pong()) ?? Behavior::same(),
);

// Spawn and interact
$system = ActorSystem::create('my-app', new FiberRuntime());
$ref = $system->spawn(Props::fromBehavior($pongActor), 'pong');
$response = $ref->ask(fn(ActorRef $replyTo) => new Ping($replyTo), Duration::seconds(5));
// $response is Pong

Key Features

  • Type-safe actors — Generic ActorRef<T>, Behavior<T>, Props<T> with Psalm level 1 enforcement
  • Supervision trees — One-for-one restart strategies with retry windows (all-for-one, escalation, and backoff are in progress)
  • Event sourcing & durable state — Persist events or state snapshots with automatic recovery on restart
  • Pluggable runtimes — Write once, run on PHP Fibers (dev), Swoole coroutines (production), or the deterministic Step runtime (tests)
  • TCP clustering (experimental) — Swoole TCP mesh with gossip membership, phi-accrual failure detection, and location-transparent ClusterRef
  • Symfony Messenger bridge (experimental) — produce to and consume from any broker Messenger supports
  • OpenTelemetry observability — traces, metrics, and logs across every actor boundary
  • Custom Psalm plugin — actor-specific static analysis rules catch concurrency bugs at compile time

Packages

41 packages, split from the monorepo and published independently on Packagist with synchronized versions. See the stability matrix for the per-package Stable/Experimental status.

Start here
skeleton composer create-project starter with the setup wizard
core Actors, behaviors, supervision, mailboxes
runtime-fiber PHP Fiber runtime (development)
runtime-swoole Swoole coroutine runtime (production)
persistence Event sourcing & durable state
maker make:actor / make:message generators

Maturity: Nexus is pre-1.0 and under active development. APIs may change between minor versions, and several subsystems are experimental — the independent audit and its remediation backlog document exactly where things stand.


Backed by Monadial · MIT License

Popular repositories Loading

  1. nexus nexus Public

    Concurrent PHP, done right.

    PHP 1

  2. core core Public

    Read-only subtree split of monadial/nexus. Submit issues and PRs to the main repository.

    PHP

  3. serialization serialization Public

    Read-only subtree split of monadial/nexus. Submit issues and PRs to the main repository.

    PHP

  4. runtime-fiber runtime-fiber Public

    Read-only subtree split of monadial/nexus. Submit issues and PRs to the main repository.

    PHP

  5. runtime-swoole runtime-swoole Public

    Read-only subtree split of monadial/nexus. Submit issues and PRs to the main repository.

    PHP

  6. runtime-step runtime-step Public

    Read-only subtree split of monadial/nexus. Submit issues and PRs to the main repository.

    PHP

Repositories

Showing 10 of 48 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…