Skip to content

Support running on stock PHP (without TrueAsync fork) #6

@EdmondDantes

Description

@EdmondDantes

Today the extension requires the TrueAsync php-src fork because it depends on the native coroutine and udp_bind APIs from ext-async. Investigate and implement a path to run on stock upstream PHP 8.6+.

Goals

  • Detect at build time whether the host PHP has the TrueAsync async API; fall back to a non-async I/O strategy when it doesn't.
  • Provide a synchronous / fiber-based execution model on stock PHP — request handlers run on PHP Fibers scheduled on an internal libuv loop owned by the extension.
  • Preserve the public HttpServer API surface so user code does not have to change.
  • Document the feature/perf delta clearly: no shared-loop integration with user code, no udp_bind (so HTTP/3 may be limited or unavailable on stock PHP), no deep coroutine integration with user-space libraries.

Open questions

  • Can HTTP/3 work on stock PHP if the extension owns the UDP socket itself, bypassing the missing udp_bind?
  • How is the event loop driven from a stock PHP CLI script — a blocking $server->start() that owns the thread, vs. an explicit $server->tick()?
  • What's the minimum PHP version we can realistically target (8.1 for Fibers, 8.6 for current TrueAsync features)?

Acceptance

  • pecl install (or equivalent) on a vanilla PHP 8.x build produces a working extension.
  • Hello, World! quickstart from the README runs unchanged on stock PHP.
  • Docs clearly state which features require the TrueAsync fork.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions