laminas/laminas-diactoros
Laminas Diactoros is a PHP PSR-7 implementation of HTTP messages, providing request, response, server request, stream, upload, and URI classes plus PSR-17 factories for interoperable web applications and middleware.
Request, Response, ServerRequest, UploadedFile, Stream) and PSR-17 factories. The decision this informs is "do we write our own HTTP value objects?" — answer: no. We buy the primitives and spend engineering time on product logic.nyholm/psr7, and guzzlehttp/psr7. This assessment supports choosing Diactoros when we want the most feature-complete implementation (server-request-from-globals, uploaded-file handling, JSON responses) with heavy static-analysis QA; choosing Nyholm when we optimize strictly for footprint and speed.Request/Response inside) rather than letting Illuminate\Http types leak into domain code. Diactoros makes that seam cheap to implement via symfony/psr-http-message-bridge.Adopt when:
ServerRequestFactory::fromGlobals(), SAPI header discovery, UploadedFile semantics, JsonResponse, and stream handling — not just bare request/response objects.Look elsewhere when:
Illuminate\Http\Request/Response already covers it; adding Diactoros is indirection with no payoff.psr/http-message bridge — nyholm/psr7 is smaller, faster to boot, and the more common pairing in Symfony/Laravel-adjacent stacks.guzzlehttp/psr7 avoids a second implementation and a second streaming model.laminas/laminas-httphandlerrunner or a dispatcher.To executives: This is a small, permissively licensed (BSD-3) library that gives us standard-shaped HTTP requests and responses — the same shape nearly every PHP framework and third-party API library already understands. Adopting it costs essentially nothing in licensing and lets us sell integrations and SDKs to customers who are not on Laravel, which widens our addressable market. Maintenance risk is low: active releases, current PHP support (8.1 through 8.5), published security policy, and automated backwards-compatibility checks.
To engineering: It is the boring, correct choice for PSR-7/PSR-17 primitives — strictly typed, Psalm-annotated, conformance-tested, with server-request-from-globals and uploaded-file handling built in, so we are not reimplementing header parsing and stream semantics. It buys us compatibility with PSR-15 middleware, OAuth2 servers, OpenAPI validators, and any PSR-18 client work, and it gives us a clean seam between HTTP and domain code via the Symfony PSR bridge. Trade-off is footprint and a second ecosystem's conventions; if we are Laravel-only, or Guzzle or Nyholm is already in the tree, we should not add it. Recommendation: adopt behind an internal HTTP boundary, not scattered through controllers.
How can I help you explore Laravel packages today?