davidecesarano/embryo-emitter

Emitter for psr-7 response.

1.0.0 2020-12-07 11:36 UTC

This package is auto-updated.

Last update: 2024-11-07 19:49:17 UTC


README

Emitter for PSR-7 response.

Requirements

Installation

Using Composer:

$ composer require davidecesarano/embryo-emitter

Usage

Emitting a PSR-7 response content via echo.

use Embryo\Http\Factory\ResponseFactory;
use Embryo\Http\Emitter\Emitter;

$response = (new ResponseFactory)->createResponse(200);
$emitter  = new Emitter;

$body = $response->getBody();
$body->write('Hello World!');
$response = $response->withBody($body);

$emitter->emit($response); // Hello World!