yiisoft/psr-emitter

PSR-7 HTTP response emitter

Maintainers

👁 samdark
👁 vjik

Package info

github.com/yiisoft/psr-emitter

Homepage

Chat

Forum

Wiki

pkg:composer/yiisoft/psr-emitter

Fund package maintenance!

Opencollective

yiisoft

Statistics

Installs: 62 445

Dependents: 2

Suggesters: 0

Stars: 3

Open Issues: 1

1.0.1 2025-12-20 05:12 UTC

Requires

Suggests

Provides

None

Conflicts

None

Replaces

None

BSD-3-Clause d09a29d1feec91596491973757f6a112991e29b3

httpemitterpsr-7

This package is auto-updated.

Last update: 2026-06-24 21:45:52 UTC


README

👁 Yii

Yii PSR Emitter


👁 Latest Stable Version
👁 Total Downloads
👁 Build status
👁 Code Coverage
👁 Mutation testing badge
👁 Static analysis
👁 type-coverage
👁 psalm-level

The package 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.

Requirements

  • PHP 8.1 - 8.5.

Installation

The package could be installed with Composer:

composer require yiisoft/psr-emitter

General usage

Create emitter instance and call emit() method with a PSR-7 response:

use Psr\Http\Message\ResponseInterface;
use Yiisoft\PsrEmitter\SapiEmitter;

/** @var Response $response */

$emitter = new SapiEmitter();
$emitter->emit($response);

You can customize the buffer size (by default, 8MB) for large response bodies:

use Psr\Http\Message\ResponseInterface;
use Yiisoft\PsrEmitter\SapiEmitter;

/** @var Response $response */

$emitter = new SapiEmitter(4_194_304); // Buffer size is 4MB

// Response content will be sent in chunks of 4MB
$emitter->emit($response);

Documentation

If you need help or have a question, the Yii Forum is a good place for that. You may also check out other Yii Community Resources.

License

The Yii PSR Emitter is free software. It is released under the terms of the BSD License. Please see LICENSE for more information.

Maintained by Yii Software.

Support the project

👁 Open Collective

Follow updates

👁 Official website
👁 Twitter
👁 Telegram
👁 Facebook
👁 Slack