PHP RFC: True Async
The TrueAsync project advances through the official RFC process on wiki.php.net.
Two RFCs have been published describing the basic concurrency model
and structured concurrency.
RFC #1 — PHP True Async
The main RFC defining the concurrency model for PHP.
Describes coroutines, functions spawn() / await() / suspend(),
the Coroutine object, Awaitable and Completable interfaces,
cooperative cancellation mechanism, Fiber integration,
error handling and graceful shutdown.
Key principles:
- Minimal changes to existing code to enable concurrency
- Coroutines maintain the illusion of sequential execution
- Automatic coroutine switching on I/O operations
- Cooperative cancellation — “cancellable by design”
- Standard C API for extensions
RFC #2 — Scope and Structured Concurrency
An extension of the base RFC. Introduces the Scope class, binding
coroutine lifetime to the lexical scope.
Describes scope hierarchy, error propagation,
“zombie” coroutine policy and critical sections via protect().
What it solves:
- Preventing coroutine leaks beyond the scope
- Automatic resource cleanup on scope exit
- Hierarchical cancellation: cancelling the parent → cancels all children
- Protecting critical sections from cancellation
- Deadlock and self-await detection
How these RFCs relate
The first RFC defines low-level primitives — coroutines, base functions and C API for extensions. The second RFC adds structured concurrency — mechanisms for managing groups of coroutines that make concurrent code safe and predictable.
Together they form a complete asynchronous programming model for PHP:
| RFC #1: True Async | RFC #2: Scope | |
|---|---|---|
| Level | Primitives | Management |
| Provides | spawn(), await(), Coroutine |
Scope, TaskGroup, protect() |
| Analogies | Go goroutines, Kotlin coroutines | Kotlin CoroutineScope, Python TaskGroup |
| Goal | Running concurrent code | Safe lifecycle management |
Join the Discussion
RFCs are discussed on the internals@lists.php.net mailing list and on GitHub Discussions.
Also join the conversation on Discord.