As the name says, it is made to be basic and direct.
Middleware class Participant in processing a server request and response.
An HTTP middleware component participates in processing an HTTP message: by acting on the request, generating the response, or forwarding the request to a subsequent middleware and possibly acting on its response.
Basicis\Http\Server\MiddlewareInterface
Name | Description |
---|---|
__invoke | Function process |
Process an incoming server request a alias to process method | |
pipeLine | Funtion setPipeLine |
Handle all middlewares | |
process | Function process |
Process an incoming server request. |
Description
public __invoke (\ServerRequestInterface $request, \ResponseInterface $response, \MiddlewareInterface|null $next)
Function process Process an incoming server request a alias to process method
Parameters
(\ServerRequestInterface) $request
(\ResponseInterface) $response
(\MiddlewareInterface|null) $next
Return Values
\ResponseInterface
Description
public static pipeLine (array $middlewares, \ServerRequestInterface $request, \ResponseInterface $response, callable $next)
Funtion setPipeLine Handle all middlewares
Parameters
(array) $middlewares
(\ServerRequestInterface) $request
(\ResponseInterface) $response
(callable) $next
Return Values
\PipeLine
Description
public process (\ServerRequestInterface $request, \ResponseInterface $response, callable|null $next)
Function process Process an incoming server request.
Processes an incoming server request in order to produce a response.
If unable to produce the response itself, it may delegate to the provided
request $next handler to do so.
//Perform here all persoal code implementation and return $next
retrun $next($request);
//Or receive um ResponseInterface from $next and procces you ResponseInterface
$response = $next($request);
...
retrun $response;
Parameters
(\ServerRequestInterface) $request
(\ResponseInterface) $response
(callable|null) $next
Return Values
\ResponseInterface