Skip to content

Async event loop

Greg Bowler edited this page May 1, 2025 · 3 revisions

PHP is a procedural language — it won’t call your Deferred's processing function automatically. For your promises to resolve, you’ll need an event loop to run the pending processes.

This could be a simple loop like:

while($runner->hasPendingTasks()) {
	$runner->tick();
}

For production use, consider using a solution built for looping PHP. PHP.GT/async is the complementary library for handling asynchronous looping, which is built to coordinate these tasks efficiently in real-world PHP environments.

Clone this wiki locally