PHPackages                             kekos/http-emitter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. kekos/http-emitter

ActiveLibrary[HTTP &amp; Networking](/categories/http)

kekos/http-emitter
==================

Emitting PSR-7 responses.

v1.0.0(3w ago)0214↑222.4%MITPHPPHP ^8.1CI passing

Since May 13Pushed 3w agoCompare

[ Source](https://github.com/Kekos/http-emitter)[ Packagist](https://packagist.org/packages/kekos/http-emitter)[ RSS](/packages/kekos-http-emitter/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

Http Response Emitter
---------------------

[](#http-response-emitter)

### Emits a Response to the PHP Server API.

[](#emits-a-response-to-the-php-server-api)

This is a fork of the abandoned project [narrowspark/http-emitter](https://github.com/narrowspark/http-emitter).

The available emitter implementations are.

```
- `Kekos\HttpEmitter\SapiEmitter`
- `Kekos\HttpEmitter\SapiStreamEmitter`.

```

> **Note:** each use the native PHP functions `header()` and `echo` to emit the response.

> **Note:** if headers have been sent, or the output buffer exists, and has a non-zero length, the emitters raise an exception, as mixed PSR-7 / output buffer content creates a blocking issue.
>
> If you are emitting content via `echo`, `print`, `var_dump`, etc., or not catching PHP errors / exceptions, you will need to either fix your app to always work with a PSR-7 response. Or provide your own emitters that allow mixed output mechanisms.

Installation
------------

[](#installation)

```
composer require kekos/http-emitter
```

Use
---

[](#use)

How to use the SapiEmitter:

```
