All projects

Open-source project

Matrix

Bringing JavaScript-style async to PHP! Manage asynchronous tasks with ease using a modern, fiber-powered API for seamless concurrency and error handling.

59 stars2 forksPHP

About the project

Matrix provides small, event-driven async helpers for ReactPHP. It makes promise composition, concurrency limits, retries, timeouts, cancellation, and rate limiting consistent without pretending to create threads or process-level parallelism.

PHP 8.3 or newer react/event-loop 1.6 or newer react/promise 3.3 or newer

No pcntl , posix , or sockets extension is required.

Problem

Asynchronous PHP can become hard to reason about when task ownership, failure behavior, and event visibility are unclear.

Architecture

A PHP async-oriented library exploring concurrency, task coordination, and event-driven application flows.

Design decisions

  • Model concurrency through explicit primitives rather than hidden control flow.
  • Make failure propagation and cancellation behavior part of the API design.
  • Keep the library composable with application-level observability and framework patterns.

Constraints and lessons

Constraints

  • Async APIs need to stay understandable under operational pressure.
  • The primitive should remain small enough to compose with real applications.

Lessons

  • Event-driven design needs visible causality, not just decoupling.
  • Async library ergonomics are reliability work.

Maintained as a public library and architecture learning surface.