pilotphp/runtime-roadrunner

RoadRunner HTTP and gRPC worker adapter for the PilotPHP Agent-First framework.

Maintainers

Package info

gitlab.com/pilotphp/runtime-roadrunner

Issues

pkg:composer/pilotphp/runtime-roadrunner

Transparency log

Statistics

Installs: 7

Dependents: 0

Suggesters: 0

Stars: 0

0.1.4 2026-08-02 19:20 UTC

This package is auto-updated.

Last update: 2026-08-02 18:45:19 UTC


README

RoadRunner worker adapter for the PilotPHP Agent-First framework.

pilotphp/runtime-roadrunner connects long-lived RoadRunner HTTP and gRPC worker processes to PilotPHP transport applications (HttpApplication, GrpcApplication). It owns the receive/respond loop, process boot/shutdown gate, transport ports, and worker error/recycle policy. It does not compile artifacts, assemble the application container, or dispatch operations directly.

Requirements

  • PHP 8.5+
  • pilotphp/contracts ^0.1.2
  • pilotphp/runtime ^0.1.2
  • pilotphp/http ^0.1.4
  • pilotphp/grpc ^0.1.4
  • Spiral RoadRunner worker packages (spiral/roadrunner-http, spiral/roadrunner-grpc, spiral/roadrunner-worker)

Install

composer require pilotphp/runtime-roadrunner

Discovery uses the fixed path pilot/package.json inside the Composer package root. This package does not publish extra.pilotphp.manifest.

Note: pilotphp/http and pilotphp/grpc may not yet be on Packagist. See docs/blockers.md for local development workarounds.

Modes

ModeWorker loopTransport applicationReset owner
HTTPRoadRunnerHttpWorkerLoopHttpApplicationHttpApplication
gRPCRoadRunnerGrpcWorkerLoopGrpcApplicationHostRequestCycle + InvokeTrackingKernel

Each mode uses a separate RoadRunner worker entry script and .rr.yaml plugin section. See examples/ and docs/rr-configuration.md.

Bootstrap sketch

Build and artifact loading happen outside this package. The application owns composition; the worker only loads finalized bytes and runs the loop.

# Build time (CI / deploy, NOT in worker)
php bin/pilot build
  → finalized artifacts (http/route-map.json, grpc/method-map.json, container, …)

# Worker boot (application bootstrap)
require vendor/autoload.php
  → App\RuntimeAssembler loads artifact bytes
  → constructs ContainerInterface, KernelInterface, transport apps
  → wraps kernel with InvokeTrackingKernel (gRPC only)
  → RoadRunnerHttpWorkerLoop or RoadRunnerGrpcWorkerLoop::run()

Who does what:

ConcernOwner
Build (php bin/pilot build)Application / pilotphp/build
Load artifact bytesApplication bootstrap
Assemble RuntimeKernel, container, dispatch graphApplication / RuntimeAssembler
Boot / shutdownWorkerLifecycle via WorkerProcessGate
Per-request reset (HTTP)HttpApplication
Per-request reset (gRPC)HostRequestCycle + InvokeTrackingKernel
Receive/respond loopThis package

Non-goals

  • Running pilotphp/build or any build stage inside a worker
  • Depending on pilotphp/operation, pilotphp/container, or pilotphp/app
  • Registering compile-time metadata (register() is intentionally empty)
  • Publishing a BuildStage or finalized artifact schema
  • Replacing HttpApplication / GrpcApplication routing or mapping logic
  • Using Spiral\RoadRunner\GRPC\Server reflection-based service registration

Public API (summary)

TypeRole
RoadRunnerRuntimePackagePackage identity; empty register()
RoadRunnerHttpWorkerLoopHTTP wait → handle → respond loop
RoadRunnerGrpcWorkerLoopgRPC wait → decode → handle → respond loop
RoadRunnerHttpWorkerPortProduction HTTP transport port
RoadRunnerGrpcWorkerPortProduction gRPC payload port (no Server::registerService)
WorkerProcessGateBoot once, job counting, recycle, shutdown
HostRequestCyclegRPC per-job scope + reset (HTTP must not use this)
InvokeTrackingKernelRequired gRPC kernel decorator
RoadRunnerWorkerOptionsAdapter recycle and error policy
WorkerExitCodeProcess exit outcome enum

Documentation

Examples

Illustrative worker entry scripts and minimal RoadRunner configs:

Examples are not executable application skeletons — they show bootstrap shape with placeholder App\RuntimeAssembler comments.

License

MIT