QueueRequestHandler
in package
implements
RequestHandlerInterface
uses
Getter
A queue-based PSR-15 HTTP Server Request Handler.
Tags
Table of Contents
Interfaces
- RequestHandlerInterface
Properties
- $queue : MiddlewareQueue
- $request : ServerRequestInterface
- $response : ResponseInterface
Methods
- __construct() : void
- Create a queue-based PSR-15 HTTP Server Request Handler.
- __invoke() : ResponseInterface
- Allow the request handler to be invoked directly.
- handle() : ResponseInterface
- Handles a request by invoking a queue of middlewares.
- respond() : void
- Return the current response to the client.
Properties
$queue read-only
public
MiddlewareQueue
$queue
$request read-only
public
ServerRequestInterface
$request
$response read-only
public
ResponseInterface
$response
Methods
__construct()
Create a queue-based PSR-15 HTTP Server Request Handler.
public
__construct([iterable<string|int, MiddlewareInterface> $middlewares = [] ]) : void
Parameters
- $middlewares : iterable<string|int, MiddlewareInterface> = []
-
Initial set of middlewares
__invoke()
Allow the request handler to be invoked directly.
public
__invoke([ServerRequestInterface|null $request = null ]) : ResponseInterface
Parameters
- $request : ServerRequestInterface|null = null
-
The PSR-7 server request to handle
Return values
ResponseInterface —A PSR-7 compatible HTTP response
handle()
Handles a request by invoking a queue of middlewares.
public
handle([ServerRequestInterface|null $request = null ]) : ResponseInterface
APIYes
Parameters
- $request : ServerRequestInterface|null = null
-
The PSR-7 server request to handle
Return values
ResponseInterface —A PSR-7 compatible HTTP response
respond()
Return the current response to the client.
public
respond([int|null $exitCode = null ]) : void
APIYes
Parameters
- $exitCode : int|null = null
-
Exit status after sending out the response or NULL to continue
Must be in the range 0 to 254. The status 0 is used to terminate the program successfully.