Open-source project
Matrix
Event-driven async helpers for ReactPHP with promise composition, cancellation, timeouts, concurrency limits, and rate limiting.
About the project
Matrix provides event-driven async helpers for ReactPHP: promise composition, concurrency limits, retries, timeouts, cancellation, rate limiting, events, and metrics. Work runs cooperatively on one event loop; callbacks must use nonblocking I/O.
This README is the repository's documentation, including the API reference, migration guide, and release history.
Matrix requires PHP 8.3 or newer, react/event-loop ^1.6, and react/promise ^3.3. Composer installs the ReactPHP dependencies. The pcntl , posix , and sockets extensions are optional.
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.