Final Class Yiisoft\PsrEmitter\EmitterMiddleware
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Psr\ |
EmitterMiddleware is a middleware that sends the response to the client using implementation of EmitterInterface.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| process() | Yiisoft\ |
Method Details
| public mixed __construct ( Yiisoft\ | ||
| $emitter | Yiisoft\ |
Emitter to send the response. |
public function __construct(
private readonly EmitterInterface $emitter = new SapiEmitter(),
) {}
| public \ | ||
| $request | \ |
|
| $handler | \ |
|
| throws | Yiisoft\ |
If headers have already been sent. |
|---|---|---|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$response = $handler->handle($request);
$this->emitter->emit($response);
return $response;
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.