承接 kjljon/streamingiterable 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

kjljon/streamingiterable

最新稳定版本:v1.0.0

Composer 安装命令:

composer require kjljon/streamingiterable

包简介

Convert iteratables into with streams using psr-7 without any other dependencies

README 文档

README

The idea of this package is to make it easier to work with iterable data as streams

Problem it solves

I find myself exporting data to the file system and using flysystem's writeStream. This becomes an issue when you don't have much local storage to write large exports to.

So my first iteration was pretty ugly (but worked), but then I saw what Guzzle's PSR-7 package did with StreamWrapper and using PSR-7 and figured I could refactor my app to use PSR-7.

My second iteration worked, but still assumed the export was a specific file type (csv).
When I had the requirements to stream JSON, I decided to refactor a little again by adding the ability to add a formatter decorator.

Usage

$iterable = [
    ['first' => 'Jim', 'last' => 'Thompson', 'month' => 'April'],
    ['first' => 'Tim', 'last' => 'Johnson', 'month' => 'December']
];

$formatter = new KJLJon\StreamingIterable\Formatter\CsvFormatter();
$stream = new KJLJon\StreamingIterable\IterableToReaderStream($iterable, $formatter);
$fp = KJLJon\StreamingIterable\StreamWrapper::getResource($stream);

//do something with stream (IE: flyweight's writeStream($location, $fp);
fpassthru($fp);

fclose($fp);

Questions / Comments

Please open an issue and/or pull request

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固