PHP 8.6 added Io\Poll, a small API that tells you when streams are ready to read or write. It was kept minimal on purpose. Jakub Zelenka's RFC fills the gaps you hit when you try to build an event loop on top of it.
Today an event loop still has to handle timers, signals and child processes on its own. Every loop library ends up writing the same code for these. This RFC moves that work into PHP.
What changes
The RFC adds four groups of features:
- Generic handles.
TimerHandle,SignalHandle,ProcessHandleandNotifyHandlelet you wait on a timer, a signal likeSIGTERM, a child process exiting, or a manual wake-up. - Weak handles.
StreamPollWeakHandledoesn't keep its stream open. When the stream closes, PHP removes it from every context for you. - Socket handles.
Socketobjects from ext/sockets can now be polled too. - Priority events. A new
Event::Prioritycase exposesPOLLPRIdata.
Here is the RFC's timer example:
use Io\Poll\{Context, Event, TimerHandle}; use Time\Duration; $ctx = new Context(); $tick = new TimerHandle(Duration::fromMilliseconds(500), periodic: true); $ctx->add($tick, [Event::Timer], 'tick'); $deadline = new TimerHandle(Duration::fromSeconds(3)); $ctx->add($deadline, [Event::Timer], 'deadline'); while (true) { foreach ($ctx->wait() as $watcher) { if ($watcher->getData() === 'deadline') { echo "done\n"; break 2; } echo "tick\n"; } }
This prints "tick" every half second and stops after three seconds. You don't compute any timeouts yourself.
NotifyHandle solves another old problem. A signal handler can't normally wake up a loop that's waiting. With a notify handle, the handler calls notify() and the loop wakes right away.
What it means for existing code
Nothing breaks. The RFC only adds new classes and enum cases. The one catch is that Io\Poll\Event gets new cases, so a match over it with no default arm would need updating. SignalHandle only works in the CLI on thread-safe builds.
Where it stands
Jakub Zelenka announced the RFC on the internals list on September 30, 2026. It targets PHP 8.7. It is also the base for his IO Hooks and Operations RFC, announced the same day. A working version is part of his IO hooks pull request, php-src PR #23997, and he plans to split it into its own pull request. A vote would need a two-thirds majority.