yiisoft/psr-emitter 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yiisoft/psr-emitter

最新稳定版本:1.0.1

Composer 安装命令:

composer require yiisoft/psr-emitter

包简介

PSR-7 HTTP response emitter

README 文档

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

统计信息

  • 总下载量: 18.24k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 13
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2025-05-17