PHPackages                             narrowspark/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. narrowspark/http-emitter

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

narrowspark/http-emitter
========================

Emitting psr-7 responses.

v2.0.4(5y ago)35155.9k—2.9%10[11 PRs](https://github.com/narrowspark/http-emitter/pulls)5MITPHPPHP ^8.0

Since Apr 4Pushed 3y ago3 watchersCompare

[ Source](https://github.com/narrowspark/http-emitter)[ Packagist](https://packagist.org/packages/narrowspark/http-emitter)[ GitHub Sponsors](https://github.com/prisis)[ Fund](https://opencollective.com/_prisis_)[ RSS](/packages/narrowspark-http-emitter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (35)Used By (5)

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

[](#http-response-emitter)

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

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

 [![](https://camo.githubusercontent.com/e0d1758ba05b78acf603d046a4bc31de5c2d2e2d2d9bf5553df4a44a1724bd52/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6172726f77737061726b2f687474702d656d69747465722e7376673f7374796c653d666c61742d737175617265)](https://github.com/narrowspark/http-emitter/releases) [![](https://camo.githubusercontent.com/07ada699e58b2884a5b67492abbcf4797bf99391f003fe20e5ba2782d52e3cd5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e302e302d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/) [![](https://camo.githubusercontent.com/4461d0e7795fa24b9a0c525212b304ed7acdf1bd8e7150dcf0296744af782ee1/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f727573742d6c616e672f727573742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/narrowspark/http-emitter) [![](https://camo.githubusercontent.com/94389f08848458061c0d92a86150a97bae7379e261caeb5c7782f4b3e51d988e/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6e6172726f77737061726b2f687474702d656d69747465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/narrowspark/http-emitter) [![](https://camo.githubusercontent.com/495929dee39511a584ee7ba0ff2e7618c1c99890e40daf68094a750073555663/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2532302532302546302539462539332541362546302539462539412538302d73656d616e7469632d2d72656c656173652d6531303037392e7376673f7374796c653d666c61742d737175617265)](https://github.com/semantic-release/semantic-release) [![](https://camo.githubusercontent.com/bae28b329a8b0b3241fca202350eecd13ed47fc3eca564c6d060feb620265e00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6e7472696275746f72253230436f76656e616e742d322e302d3462616161612e7376673f7374796c653d666c61742d737175617265)](.github/CODE_OF_CONDUCT.md) [![](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://opensource.org/licenses/MIT)

The available emitter implementations are.

```
- `Narrowspark\HttpEmitter\SapiEmitter`
- `Narrowspark\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 narrowspark/http-emitter
```

Use
---

[](#use)

How to use the SapiEmitter:

```
