- Is laminas/laminas-diactoros a Laravel package or a PSR-7 library?
- It is a PHP PSR-7 HTTP message implementation, not a Laravel-specific package. Laravel applications usually pull it in transitively through PSR-7 bridges or SDKs rather than installing it as a first-class framework dependency. It provides requests, responses, server requests, streams, uploaded files, and URIs.
- How do I install laminas/laminas-diactoros in a Laravel application?
- Install it with Composer using composer require laminas/laminas-diactoros. There is no Laravel service provider, config file to publish, or migration to run. In most Laravel apps it is already present as a transitive dependency, so verify the resolved version before adding it explicitly.
- Do I need to register a service provider or publish config for Laminas Diactoros in Laravel?
- No. Laminas Diactoros is a Composer-only library with no Laravel integration layer, so there is nothing to register in config/app.php or publish with artisan vendor:publish. You use its PSR-7 classes directly or through whatever PSR-7 bridge or SDK already depends on it.
- Which PHP and Laravel versions does laminas/laminas-diactoros 3.9.0 support?
- Version 3.9.0 is PHP 8.x only, so confirm your Laravel deployment target meets that requirement. It is framework-agnostic and does not pin a Laravel version; compatibility is determined by the PSR-7 bridge, Passport version, or SDK that brings it into your project. Check the resolved package constraints in composer.lock rather than assuming a Laravel-specific support matrix.
- Why is laminas/laminas-diactoros already in my Laravel composer.lock?
- It commonly arrives through symfony/psr-http-message-bridge consumers such as Laravel Passport, or through third-party SDKs and PSR-18 HTTP clients that need PSR-7 messages. That makes it infrastructure you pin and audit rather than a package you build against directly. Use composer why laminas/laminas-diactoros to see which dependency introduced it.
- How do I create a PSR-7 request from Laravel's globals using ServerRequestFactory::fromGlobals()?
- Use Laminas\Diactoros\ServerRequestFactory::fromGlobals() when you need to synthesize a PSR-7 server request from PHP superglobals for an outbound SDK call or PSR-15 middleware. In a normal Laravel request lifecycle the framework uses Symfony HttpFoundation, so these objects are not the primary request representation. Be mindful in Octane or RoadRunner workers where superglobals may not be repopulated per request.
- Does laminas/laminas-diactoros 3.9.0 support HTTP/3 and PSR-15 middleware?
- Yes, 3.9.0 adds HTTP/3 version handling, which is mainly useful for accurate protocol reporting in logs, audit trails, and rate-limiting headers when CDN or load-balancer edges surface HTTP/3 values. It also integrates with PSR-15 middleware through PSR-7 messages. HTTP/3 support is a correctness and telemetry concern, not a replacement for Laravel's Symfony-based routing kernel.
- Will the type declarations in laminas/laminas-diactoros 3.9.0 break my custom UploadedFile or ServerRequest subclasses?
- Potentially, yes. PR #202 added native parameter and return type declarations, and that is the one change in this minor release that can cause fatal errors or LSP violations for subclasses or hand-rolled test doubles with mismatched signatures. If you extend Laminas\Diactoros\UploadedFile or ServerRequest, run a short verification pass on a feature branch before upgrading.
- How should I test Laravel code that depends on Laminas Diactoros PSR-7 messages?
- Instantiate the real Diactoros request, response, stream, and uploaded-file objects in tests where practical, and keep any test doubles' method signatures aligned with the library's native type declarations. If you use mocks or custom subclasses, re-run the suite after upgrading to 3.9.0 to catch covariance or contravariance breaks. For server-request behavior, test the seam where you call ServerRequestFactory::fromGlobals() rather than assuming Laravel's kernel produces PSR-7 objects.
- Is laminas/laminas-diactoros actively maintained, and how does it compare to nyholm/psr7 or guzzlehttp/psr7?
- The 3.9.0 release includes five merged pull requests from five distinct contributors, including a substantive HTTP/3 feature and static-analysis improvements, which is a healthy conservative cadence. The earlier dependents: 0 signal was a data artifact rather than a project-health problem, though the release notes lack an explicit publish timestamp. Compared with nyholm/psr7 or guzzlehttp/psr7, Diactoros is a fuller PSR-7 implementation with server-request and uploaded-file factories, and in Laravel it is usually chosen for you by a transitive dependency rather than picked directly.