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.

60 stars2 forksPHP

About the project

Matrix is a PHP library that brings event-driven, asynchronous programming to PHP, inspired by JavaScript's async / await syntax. Built on top of ReactPHP's event loop, Matrix makes it easier to write non-blocking I/O operations and manage concurrency with a simple, intuitive API.

Important : PHP runs in a single-threaded environment. Matrix doesn't create true parallelism but enables event-driven, non-blocking I/O operations through ReactPHP's event loop. This means: ✅ Non-blocking I/O : Network requests, file operations, and timers don't block execution ✅ Concurrent operations : Multiple I/O operations can run simultaneously ❌ CPU-bound tasks : Heavy computations will still block the even…

Matrix shines when dealing with I/O-heavy applications like API clients, web scrapers, or microservices.

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.