定制 yiisoft/psr-emitter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱: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.08k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固