httpsoft/http-emitter 问题修复 & 功能扩展

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

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

httpsoft/http-emitter

最新稳定版本:1.1.1

Composer 安装命令:

composer require httpsoft/http-emitter

包简介

Emitting of PSR-7 Response implementation

README 文档

README

License Latest Stable Version Total Downloads GitHub Build Status GitHub Static Analysis Status Scrutinizer Code Coverage Scrutinizer Code Quality

This package emitting implementations of Psr\Http\Message\ResponseInterface from PSR-7 HTTP Message.

Documentation

Installation

This package requires PHP version 7.4 or later.

composer require httpsoft/http-emitter

Usage SapiEmitter

use HttpSoft\Emitter\SapiEmitter;
use Psr\Http\Message\ResponseInterface;

/** @var ResponseInterface $response */
$response->getBody()->write('Content');

$emitter = new SapiEmitter();
$emitter->emit($response);
// Output result: 'Content'

By default, the entire content of the response is emitted. To emit the content in parts, it is necessary to specify a maximum buffer length:

$emitter = new SapiEmitter(8192);
$emitter->emit($response);
// Output result: 'Content'

Emitting only part of the content using the Content-Range header:

$emitter = new SapiEmitter(8192);
$emitter->emit($response->withHeader('Content-Range', 'bytes 0-3/7'));
// Output result: 'Cont'

To emitting only the status line and headers without a body, it is necessary to specify true as the second parameter:

$emitter = new SapiEmitter(8192);
$emitter->emit($response, true);
// Output result: ''

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-29