First release of Yii PSR Emitter package was done. It provides EmitterInterface that is responsible for sending PSR-7 HTTP responses as well as several implementations of the interface:
SapiEmitter- sends a response using standard PHP Server API;FakeEmiiter- a fake emitter that does nothing, except for capturing response (useful for testing purposes).
Additionally, the package provides EmitterMiddleware PSR-15 middleware that can be used in an application to send a response by any EmitterInterface implementation.
General usage:
/**
* @var \Psr\Http\Message\ResponseInterface $response
*/
$emitter = new \Yiisoft\PsrEmitter\SapiEmitter();
$emitter->emit($response);