-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
Muhammet Şafak edited this page Jun 10, 2026
·
1 revision
- PHP 8.1 or later. Fibers were added to the language in PHP 8.1, and FiberLoops is built directly on them. There is no extension to install — fibers are part of core PHP.
You can confirm your version with:
php -vcomposer require initphp/fiber-loopsThat is the whole dependency footprint: the package requires nothing but PHP itself.
FiberLoops ships a PSR-4 autoloader under the InitPHP\FiberLoops\ namespace.
Once installed, pull in Composer's autoloader and you are ready:
require_once 'vendor/autoload.php';
use InitPHP\FiberLoops\Loop;
$loop = new Loop();The public classes are:
| Class | Purpose |
|---|---|
InitPHP\FiberLoops\Loop |
The scheduler. |
InitPHP\FiberLoops\LoopInterface |
The contract Loop implements (depend on this for inversion / mocking). |
InitPHP\FiberLoops\Exception\LoopException |
Thrown when the loop is misused (e.g. yielding outside a fiber). |
Save this as smoke.php next to your vendor/ directory and run it:
<?php
require_once 'vendor/autoload.php';
use InitPHP\FiberLoops\Loop;
$loop = new Loop();
$loop->defer(function () {
echo "FiberLoops is working.\n";
});
$loop->run();php smoke.phpFiberLoops is working.
If you see that line, you are ready for the Quick Start.
The package follows Semantic Versioning. The 2.x line
requires PHP 8.1+ and exposes the API documented throughout this wiki. See the
Changelog for what
changed between releases.
Getting Started
Using FiberLoops
Guides
Reference