pilotphp/http

HTTP transport boundary and compiled route map for the PilotPHP Agent-First framework.

Maintainers

Package info

gitlab.com/pilotphp/http

Issues

pkg:composer/pilotphp/http

Transparency log

Statistics

Installs: 9

Dependents: 1

Suggesters: 0

Stars: 0

0.1.4 2026-08-02 19:19 UTC

This package is auto-updated.

Last update: 2026-08-02 16:22:06 UTC


README

HTTP transport boundary for the PilotPHP Agent-First framework.

pilotphp/http lets application packages declare HTTP routes, compiles those declarations into a deterministic http/route-map.json artifact, loads that artifact at runtime, matches PSR-7 requests, maps them into contracts-owned invocations, and maps results back to PSR-7 responses.

It is not a web application skeleton, HTTP server, DI container, operation dispatcher, or RoadRunner/FrankenPHP adapter.

Requirements

  • PHP 8.5+
  • pilotphp/contracts ^0.1.2
  • pilotphp/runtime ^0.1.2 (Invocation / RequestContext value objects)
  • PSR-7 / PSR-17 / PSR-15 interfaces

Install

composer require pilotphp/http

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

Minimal declaration

use PilotPHP\Http\Declaration\HttpRouteDeclaration;

$registration->add(new HttpRouteDeclaration(
    routeId: 'users.show',
    methods: ['GET'],
    path: '/users/{id}',
    operationId: 'users.show',
    requestMapperServiceId: 'app.http.users.show.request',
    responseMapperServiceId: 'app.http.users.show.response',
    errorMapperServiceId: 'app.http.users.show.error',
));

Build flow

package registration
  → HttpRouteDeclaration
  → HttpBuildStage (registered by HttpPackage)
  → http/route-map.json

Runtime flow

validated finalized artifact bytes
  → HttpArtifactLoader
  → HttpRouteMap
  → HttpApplication (PSR-15)
  → KernelInterface::invoke(Invocation)
  → PSR-7 Response

Public API (summary)

TypeRole
HttpPackagePackage entrypoint; registers HttpBuildStage
HttpRouteDeclarationBuild-time route metadata
HttpBuildStageCompiles declarations into the route-map artifact
HttpArtifactLoaderValidates and loads artifact bytes
HttpRouteMap / HttpRouteMatcherImmutable matching
HttpApplicationPSR-15 request handler
HttpRequestMapperInterfaceRequest → Invocation
HttpResponseMapperInterfaceResult → Response
HttpErrorMapperInterfaceExpected failure → Response

Documentation

Development

COMPOSER=composer-local.json composer update --prefer-stable
composer check
composer test
composer analyse
composer cs-check

License

MIT