Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laminas Diactoros Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Preparing for Version 3

ServerRequestFilterInterface defaults

Introduced in version 2.11.1, the Laminas\Diactoros\ServerRequestFilter\FilterServerRequestInterface is used by ServerRequestFactory::fromGlobals() to allow modifying the generated ServerRequest instance prior to returning it. The primary use case is to allow modifying the generated URI based on the presence of headers such as X-Forwarded-Host. When operating behind a reverse proxy, the Host header is often rewritten to the name of the node to which the request is being forwarded, and an X-Forwarded-Host header is generated with the original Host value to allow the server to determine the original host the request was intended for. (We have always examined the X-Forwarded-Proto header; as of 2.11.1, we also examine the X-Forwarded-Port header.)

To accommodate this use case, we created Laminas\Diactoros\ServerRequestFilter\FilterUsingXForwardedHeaders.

Due to potential security issues, it is generally best to only accept these headers if you trust the reverse proxy that has initiated the request. (This value is found in $_SERVER['REMOTE_ADDR'], which is present as $request->getServerParams()['REMOTE_ADDR'] within PSR-7 implementations.) FilterUsingXForwardedHeaders provides named constructors to allow you to trust these headers from any source (which has been the default behavior of Diactoros since the beginning), or to specify specific IP addresses or CIDR subnets to trust, along with which headers are trusted. To prevent backwards compatibility breaks, we use this filter by default, marked to trust only proxies on private subnets.

Features will be added to the 3.11.0 version of mezzio/mezzio that will allow configuring the Laminas\Diactoros\ServerRequestFilter\FilterServerRequestInterface instance, and we recommend explicitly configuring this to utilize the FilterUsingXForwardedHeaders if you depend on this functionality. If you do not need the functionality, we recommend specifying Laminas\Diactoros\ServerRequestFilter\DoNotFilter as the configured FilterServerRequestInterface in your application immediately.

We will update this documentation with a link to the related functionality in mezzio/mezzio when it is published.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport