Google News
logo
Slim Framework - Interview Questions
What is middleware in Slim Framework?
A middleware implements the PSR-15 Middleware Interface:
 
1. Psr\Http\Message\ServerRequestInterface - The PSR-7 request object
2. Psr\Http\Server\RequestHandlerInterface - The PSR-15 request handler object

It can do whatever is appropriate with these objects. The only hard requirement is that a middleware MUST return an instance of Psr\Http\Message\ResponseInterface. Each middleware SHOULD invoke the next middleware and pass it the Request object as argument.
Advertisement