定制 kambo/httpstream 二次开发

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

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

kambo/httpstream

Composer 安装命令:

composer require kambo/httpstream

包简介

Kambo httpstream additional streams for the PSR-7

README 文档

README

Build Status Scrutinizer Code Quality Code Coverage Software License

Implementation of additional streams for the PSR-7 - HTTP message interfaces

Stream implementation

This package comes with a following stream implementations:

  • string stream
  • callback stream

Each of these stream offers additional functionality not provided by original PSR-7 stream implementations.

Install

Prefered way to install library is with composer:

composer require kambo/httpstream

Basic usage

StringStream

String stream is simple synthetic sugar that allows instantiation of stream from the string. Implementation create temporary resource which will be used as base for the StringStream and it is fully compatible with the PSR-7 stream.

$stringStream = new StringStream('foo');
$stringStream->getContents(); // returns 'foo'

CallbackStream

Callback stream provides a readonly stream wrapper around given callback function. Callback will be executed only once by invoking method getContents or by casting object into string. Result of function is not cached and whole stream is after callback invocation in unusable state. This gravely limit usage of methods tell, seek, rewind and read. They cannot be used and invoking any of them will throw exception.

$callback = function () {
    return 'bar';
};
$callbackStream = new CallbackStream($callback);
$callbackStream->getContents(); // Invoke function and returns 'bar'.
$callbackStream->getContents(); // stream is in detached state empty string ('') has been returned.

License

The MIT License (MIT), https://opensource.org/licenses/MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-07-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固