Skip to content

Releases: oxphp/runtime

v0.2.0 — OxPHP\Server\Worker migration

26 Jun 20:40
dfe695f

Choose a tag to compare

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 migrationInternal\Bridge\OxPHP is now the single point that decides class vs free function: constructor seam ?bool $useWorkerClass (autodetect via class_exists), new serve(callable): void, dual-path isWorker(). The direct oxphp_worker() call is moved out of the runner, restoring the "only the bridge calls oxphp_*" invariant. AbstractHttpRunner drives the loop through $this->bridge->serve(); the "a broken handler must never poison the worker" invariant is preserved.
  • Fix: runner dispatch testable under CLI SAPIRuntime::getRunner() coupled the SAPI gate with the type→runner dispatch table, so the PHP_SAPI === 'cli' gate short-circuited it under PHPUnit. The dispatch is extracted into a private resolveRunner(); getRunner() behaviour and the public Runtime API 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

10 May 18:42

Choose a tag to compare

Changes

  • Add support for symfony/runtime ^8.0 (alongside existing ^6.4 and ^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

25 Apr 20:43

Choose a tag to compare

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 a try/catch loop so a broken handler can never poison the worker.
  • Resetter chain — user resetters via the resetters runtime option; SymfonyContainerResetter is auto-prepended for full Symfony kernels so kernel.reset-tagged services are reset between requests.
  • Streaming — per-chunk oxphp_stream_flush() for iterable bodies and StreamedResponse (SSE / chunked transfer work out of the box).
  • PSR-17 autodiscovery — Nyholm → Guzzle → HttpSoft → Laminas; overridable via the psr17_factory runtime option.
  • No $_SERVER reads — request building goes through OxPHP\Http\RequestInterface, compatible with SUPERGLOBALS_ENABLED=false.

Requirements

  • PHP 8.4+
  • symfony/runtime ^7.x

Install

composer require oxphp/runtime:^0.1