Accessing The Request: PSR-7 Requests

PSR-7 Requests

Use Psr\Http\Message\ServerRequestInterface;

Route::get('/', function (ServerRequestInterface $request) {
    //
});
Composer require symfony/psr-http-message-bridge
composer require zendframework/zend-diactoros

You may obtain a PSR-7 request by type-hinting the request interface on your route Closure or controller method.

Laravel uses the Symfony HTTP Message Bridge component to convert typical Laravel requests and responses into PSR-7 compatible implementations.

Accessing The Request: PSR-7 Requests — Structure map

Clickable & Draggable!

Accessing The Request: PSR-7 Requests — Related pages: