RoadRunner HTTP
PSR-7/PSR-17 worker client that bridges RoadRunner's Go HTTP server to standard PHP request objects
Repository Health
Technical Analysis
RoadRunner HTTP is the PHP-side library that PSR-7-compliant frameworks and applications use to receive requests from the RoadRunner Go server. Its PSR7Worker class reads the binary request payload RoadRunner passes to a PHP worker, converts it into a standard PSR-7 ServerRequestInterface, and serializes the framework’s PSR-7 response back into the format RoadRunner expects to send to the client.
It depends on spiral/roadrunner-worker for the underlying worker/RPC transport and roadrunner-php/roadrunner-api-dto for protocol data structures, and works with any PSR-17 HTTP factory implementation (such as nyholm/psr7), making it a thin, framework-agnostic adapter layer rather than a full HTTP framework.
What You Get
PSR7Worker/PSR7WorkerInterfaceto convert RoadRunner’s binary protocol into PSR-7ServerRequestInterfaceobjects and backHttpWorker/HttpWorkerInterfacefor lower-level access to the RoadRunner HTTP worker loopGlobalStatehandling to populate PHP superglobals ($_SERVER,$_GET, etc.) consistently per request- Exception types for handling malformed requests and worker-protocol errors
- Compatibility with any PSR-17 HTTP factory implementation (e.g.
nyholm/psr7) for request/response object creation
Common Use Cases
- Wiring a PSR-15-compliant PHP framework (Laravel, Symfony, Slim) to run under the RoadRunner application server
- Building a custom lightweight PHP application that speaks directly to RoadRunner without a full framework
- Implementing framework integration packages that need a standards-based bridge to RoadRunner’s worker protocol
Under The Hood
Architecture — The library centers on src/PSR7Worker.php, which wraps an HttpWorker (src/HttpWorker.php) and a PSR-17 factory to convert RoadRunner’s binary request payloads into ServerRequestInterface objects and PSR-7 responses back into RoadRunner’s wire format; src/GlobalState.php handles PHP superglobal population so legacy code relying on $_SERVER/$_GET continues to work under the worker model. Tech Stack — PHP 8.1+, depending on psr/http-message and psr/http-factory for the PSR-7/17 contracts, spiral/roadrunner and spiral/roadrunner-worker for the underlying RPC transport, and roadrunner-php/roadrunner-api-dto for protocol DTOs; nyholm/psr7 is used as the PSR-17 implementation in tests. Code Quality — Tests are organized into tests/Unit, tests/Feature, and tests/Server directories, run via PHPUnit 10.5 with coverage reporting (test:cc script), and Psalm with a checked-in baseline enforces static-analysis discipline; php-cs-fixer keeps style consistent. API Design — The PSR7WorkerInterface contract is small and framework-agnostic — one method to wait for the next request, one to respond — so any PSR-15 middleware stack or custom router can sit on top of it with minimal glue code.