fr
fr

Question from the Symfony 5 test

How to use Symfony Request and Response objects in a middleware?

Hard

What design pattern would allow me to use Symfony \ Component \ HttpFoundation \ Request and Symfony \ Component \ HttpFoundation \ Response on an object that respects the following interface:

<?php
interface Middleware
{
    public function __invoke(
        Psr\Http\Message\ServerRequestInterface $request,
        Psr\Http\Message\ResponseInterface $response,
        callable $next= null
    ): Psr\Http\Message\ResponseInterface;
}
Author: Julien BreuxStatus: PublishedQuestion passed 253 times
Edit
3
Community Evaluations
developer avatar
Taha
25/01/2025
Wrapper
developer avatar
Auteur anonyme
17/12/2024
Adapter