davidecesarano / embryo-emitter
Emitter for psr-7 response.
Installs: 183
Dependents: 8
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=7.1
- psr/http-message: 1.0.1
Requires (Dev)
- phpstan/phpstan: ^0.12.58
This package is auto-updated.
Last update: 2024-11-07 19:49:17 UTC
README
Emitter for PSR-7 response.
Requirements
- PHP >= 7.1
- A PSR-7 http message implementation and PSR-17 http factory implementation (ex. Embryo-Http)
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!