定制 jdwx/stream 二次开发

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

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

jdwx/stream

最新稳定版本:v1.0.4

Composer 安装命令:

composer require jdwx/stream

包简介

A simple PHP module for handling arbitrarily large data streams

README 文档

README

A simple PHP module for handling arbitrarily large data streams.

Installation

You can require it with Composer:

composer require jdwx/stream

Or download the source from GitHub: https://github.com/jdwx/stream-php.git

Requirements

This module requires PHP 8.3 or later. It has no other dependencies.

Usage

This module is designed to allow returning arbitrarily large amounts of data:

  • without requiring the data to be held all in memory at the same time, and
  • without requiring all the data to be available before the initial data is returned.

This is useful, for example, for extremely large web pages or for web pages that take a long time to load to allow returning progressive updates. In smaller projects, it can also make it easier to combine smaller elements into a single output and can make it easier to post-process output or insert things at various points.

Specifically, if you have a stream like (using array notation):

[ 'Foo', $bar, 'Baz' ]

Where $bar is a Stringable object, the stream maintains $bar as an object reference. So if you then go to append $qux to the stream and determine that $bar needs to be modified, you can do that up until it has been consumed.

A smattering of tools for mocking and consuming such streams are also included, mostly for testing purposes.

Stability

This module has complete test coverage. It is relatively new but has been widely used internally with good results and is believed stable.

The interface should be relatively stable at this point.

History

This module was refactored out of a prerelease version of jdwx/web to separate concerns in June 2025.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-07