Releases: oxphp/runtime
v0.2.0 — OxPHP\Server\Worker migration
Highlights
Worker-mode entry now prefers the OxPHP\Server\Worker class introduced in the OxPHP extension (v0.9.0), with a transparent fallback to the free oxphp_*() functions on older servers. Runtime behaviour is unchanged.
| Legacy | Class API |
|---|---|
oxphp_is_worker() |
Worker::isWorkerMode() |
oxphp_worker($h) |
Worker::current()->serve($h) |
The other oxphp_* calls have no class analog and are left untouched. Scope is intentionally minimal (YAGNI) — scheduleExit/requestCount/rss/memoryUsage are not adopted.
Changes
- Worker class migration —
Internal\Bridge\OxPHPis now the single point that decides class vs free function: constructor seam?bool $useWorkerClass(autodetect viaclass_exists), newserve(callable): void, dual-pathisWorker(). The directoxphp_worker()call is moved out of the runner, restoring the "only the bridge callsoxphp_*" invariant.AbstractHttpRunnerdrives the loop through$this->bridge->serve(); the "a broken handler must never poison the worker" invariant is preserved. - Fix: runner dispatch testable under CLI SAPI —
Runtime::getRunner()coupled the SAPI gate with the type→runner dispatch table, so thePHP_SAPI === 'cli'gate short-circuited it under PHPUnit. The dispatch is extracted into a privateresolveRunner();getRunner()behaviour and the publicRuntimeAPI are unchanged.
Compatibility
No breaking changes. The only public classes (Runtime, ResetterInterface) are unchanged. Works on both new (class-based) and older (function-based) OxPHP servers.
Full Changelog: v0.1.1...v0.2.0
v0.1.1
Changes
- Add support for
symfony/runtime ^8.0(alongside existing^6.4and^7.0).
No code changes — composer constraint widening only. Public API and behavior are unchanged.
Full Changelog: v0.1.0...v0.1.1
v0.1.0 — initial release
First public release of oxphp/runtime — a Symfony Runtime component for the OxPHP SAPI.
Dispatch
OxPHP\Runtime\Runtime picks a runner by the type of object returned from index.php:
| Returned object | Runner |
|---|---|
Psr\Http\Server\RequestHandlerInterface |
Psr15Runner |
Illuminate\Contracts\Http\Kernel |
LaravelRunner |
Symfony\Component\HttpKernel\HttpKernelInterface |
HttpKernelRunner |
Symfony\Component\HttpFoundation\Response |
HttpFoundationResponseRunner (one-shot) |
Psr\Http\Message\ResponseInterface |
Psr7ResponseRunner (one-shot) |
When the OxPHP SAPI extension is absent (PHP-FPM, built-in server, CI), the runtime gracefully falls back to SymfonyRuntime — same index.php works in dev and prod.
Highlights
- Traditional and worker-loop modes — under
oxphp_is_worker(), requests are served in atry/catchloop so a broken handler can never poison the worker. - Resetter chain — user resetters via the
resettersruntime option;SymfonyContainerResetteris auto-prepended for full Symfony kernels sokernel.reset-tagged services are reset between requests. - Streaming — per-chunk
oxphp_stream_flush()for iterable bodies andStreamedResponse(SSE / chunked transfer work out of the box). - PSR-17 autodiscovery — Nyholm → Guzzle → HttpSoft → Laminas; overridable via the
psr17_factoryruntime option. - No
$_SERVERreads — request building goes throughOxPHP\Http\RequestInterface, compatible withSUPERGLOBALS_ENABLED=false.
Requirements
- PHP 8.4+
symfony/runtime^7.x
Install
composer require oxphp/runtime:^0.1