# psr-emitter
**Repository Path**: mirrors_yiisoft/psr-emitter
## Basic Information
- **Project Name**: psr-emitter
- **Description**: PSR-7 HTTP response emitter
- **Primary Language**: Unknown
- **License**: BSD-3-Clause
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2025-05-16
- **Last Updated**: 2026-02-07
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
Yii PSR Emitter
[](https://packagist.org/packages/yiisoft/psr-emitter)
[](https://packagist.org/packages/yiisoft/psr-emitter)
[](https://github.com/yiisoft/psr-emitter/actions/workflows/build.yml?query=branch%3Amaster)
[](https://codecov.io/gh/yiisoft/psr-emitter)
[](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/psr-emitter/master)
[](https://github.com/yiisoft/psr-emitter/actions/workflows/static.yml?query=branch%3Amaster)
[](https://shepherd.dev/github/yiisoft/psr-emitter)
[](https://shepherd.dev/github/yiisoft/psr-emitter)
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](https://getcomposer.org):
```shell
composer require yiisoft/psr-emitter
```
## General usage
Create emitter instance and call `emit()` method with a PSR-7 response:
```php
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:
```php
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
- [Internals](docs/internals.md)
If you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place
for that. You may also check out other [Yii Community Resources](https://www.yiiframework.com/community).
## License
The Yii PSR Emitter is free software. It is released under the terms of the BSD License.
Please see [`LICENSE`](./LICENSE.md) for more information.
Maintained by [Yii Software](https://www.yiiframework.com/).
## Support the project
[](https://opencollective.com/yiisoft)
## Follow updates
[](https://www.yiiframework.com/)
[](https://twitter.com/yiiframework)
[](https://t.me/yii3en)
[](https://www.facebook.com/groups/yiitalk)
[](https://yiiframework.com/go/slack)