Interview frequency: …
Short answer
They are lightweight execution threads (Coroutines) that can be suspended and resumed from anywhere in the call stack, allowing asynchronous code without the complexity of Promises.
Explanation
Previously, PHP did not support deep suspension and resumption of code beyond simple generators. Fiber provides a structure for cooperative Concurrency: suspend a Fiber with Fiber::suspend(), wait for an I/O signal from an Event Loop (such as Revolt or Amp), then resume it with $fiber->resume(). Libraries such as Revolt, AMPHP v3, and ReactPHP build sequential asynchronous code on Fibers without nested Promises. (FrankenPHP and RoadRunner instead use a worker model that keeps the application loaded in memory; they are not based on Fibers.)
Code example
$fiber = new Fiber(function(): void {
$data = Fiber::suspend("waiting for IO");
echo "Resumed with: " . $data;
});
$value = $fiber->start();
$fiber->resume("ready data");Common mistakes
- Assuming Fibers provide real parallel Multi-threading across multiple cores; they run on one thread with Cooperative Scheduling.