laminas/laminas-diactoros
PSR-7 HTTP message implementation (ServerRequest, Request, Response, Stream, UploadedFile, Uri) for PHP. Includes factories and utilities for creating and normalizing requests/responses, with strong type coverage and interoperability with PSR-17/PSR-15.
Feature release (minor)
Feature release (minor)
Feature release (minor)
Feature release (minor)
3.3.x bugfix release (patch)
Feature release (minor)
Feature release (minor)
Feature release (minor)
JSON_THROW_ON_ERROR in JsonResponse thanks to @TimWollaThis version adds support for PSR-7 v2.0. While we had previously added return type hints in Diactoros, there were a few cases where PSR-7 updated the interfaces to use void returns where we had not. As a result, this release represents a BC break for anybody extending our classes, as defining an extension that uses one of these methods with a mixed return type (or omitting the return type entirely) will result in a type error.
The interfaces affected were Psr\Http\Message\StreamInterface and Psr\Http\Message\UploadedFileInterface.
For consumers, this version should be entirely backwards compatible in usage. For those extending our classes, you will only run into issues when extending implementations of the above interfaces.
2.25.x bugfix release (patch)
Total issues resolved: 0
Total pull requests resolved: 1
Total contributors: 1
138: Merge release 2.24.1 into 2.25.x thanks to @github-actions[bot]
2.24.x bugfix release (patch)
Adds support for the PSR-7 v1.1 release.
Feature release (minor)
Feature release (minor)
Feature release (minor)
Feature release (minor)
Feature release (minor)
Feature release (minor)
Feature release (minor)
Feature release (minor)
Feature release (minor)
Feature release (minor)
Feature release (minor)
Feature release (minor)
laminas/laminas-coding-standard:2.3.x upgrades thanks to @Ocramiuslaminas/laminas-coding-standard:2.3.x, improved types and internal API thanks to @gsteelFeature release (minor)
UploadedFileTest::setUp() thanks to @TimWollahost headers when constructing a ServerRequest thanks to @TimWolla2.11.x bugfix release (patch)
2.11.x bugfix release (patch)
This is a SECURITY release. All users are encouraged to upgrade immediately.
This release adds features to allow filtering a ServerRequest as generated by Laminas\Diactoros\ServerRequestFactory::fromGlobals() for the purposes of initialization. Examples include:
X-Forwarded-* headers to modify the URL to represent the original client request.The features are based on a new interface, Laminas\Diactorors\ServerRequestFilter\FilterServerRequestInterface, which defines a single method:
public function __invoke(
\Psr\Http\Message\ServerRequestInterface $request
): \Psr\Http\Message\ServerRequestInterface
We provide two implementations, as follows:
Laminas\Diactoros\ServerRequestFilter\DoNotFilter will return the provided request verbatim.Laminas\Diactoros\ServerRequestFilter\FilterUsingXForwardedHeaders has named constructors that allow you to define how and when X-Forwarded-* headers are used to modify the URI instance associated with the request. These methods are:
trustAny(): this method generates a filter instance that will trust all X-Forwarded-* headers from any source.trustReservedSubnets(array $trustedHeaders = ?): this method generates a filter instance that only modifies the URL if the IP address of the requesting server is from a reserved, private subnet (localhost; classes A, B, and C subnets; and IPv6 private and local-link subnets). By default, it will trust all X-Forwarded-* headers from these sources, but you may specify a list to allow via the $trustedHeaders argument.trustProxies(array $proxyCIDRList, array $trustedHeaders = ?): this method will generate a filter instance that only modifies the URL if the requesting server matches an entry in the $proxyCIDRList. These entries may be IP addresses, or any IPv4 or IPv6 CIDR subnets. By default, it will trust all X-Forwarded-* headers from these sources, but you may specify a list to allow via the $trustedHeaders argument.ServerRequestFactory::fromGlobals() now accepts a FilterServerRequestInterface instance as the optional argument $requestFilter. If none is provided, it uses one as produced by FilterUsingXForwardedHeaders::trustReservedSubnets().
Laminas\Diactoros\marshalUriFromSapi() is deprecated, and no longer used internally.Laminas\Diactoros\ServerRequestFactory::fromGlobals() no longer consumes marshalUriFromSapi(), and instead inlines an alternate implementation. The new implementation does not consider X-Forwarded-* headers by default when generating the associated URI instance. Internally, if no FilterServerRequestInterface implementation is provided, it defaults to using an instance returned by FilterUsingXForwardeHeaders::trustReservedSubnets(). If you previously relied on X-Forwarded-* headers, you MAY need to update your code to use either the FilterUsingXForwardedHeaders::trustAny() or FilterUsingXForwardedHeaders::trustProxies() methods to generate a filter to use with ServerRequestFactory::fromGlobals().
How can I help you explore Laravel packages today?