fiber-interop

Swoole

Swoole is a PHP extension providing coroutines, an event loop and async I/O. Its coroutines are not PHP Fibers.

Swoole project site · adapter: fiber-interop/swoole

composer require fiber-interop/swoole

Conformance and test status

Conformance examples (of 25)25/25
Adapter unit testsphpunit not runnable in the verification shell (the extension is not loaded there); conformance snapshot ran with the extension
CIThe conformance numbers come from the site's daily CI run (conformance.json, PHP 8.4.27, 2026-11-11)
SkippedNone in the conformance suite

Differences

Needs ext-swoole 6.x (developed against 6.3.0RC1, PHP 8.5 NTS). Fiber::getCurrent() is null in every coroutine, so per-coroutine scopes use a context-keyed provider with the userland polyfill; the ext-scope C extension cannot see coroutine switches, so use the polyfill. Probe scope-loop.php measures code that bypasses fiber-interop: a coroutine that Swoole itself resumes (no fiber\ call) sees the scope that was active last. A service that catches the cancellation and keeps going keeps Co\run() open.

Beyond the contract

Fully conformant (25/25). Scope follows tasks started with fiber\go(); coroutines started with Swoole's go() don't inherit it. Documented: Swoole has no userland coroutine-switch hook, so the adapter calls activate() at every point where it regains control. A switch hook in Swoole would make raw coroutines scope-correct. Nothing else is documented.

All runtimes · Conformance matrix