meekframework / stream
v1.0.0
2017-11-10 13:14 UTC
Requires
- php: ^7.1
Requires (Dev)
- phpdocumentor/phpdocumentor: ^2.9
- phpunit/phpunit: ^6.3
This package is not auto-updated.
Last update: 2024-09-15 05:22:20 UTC
README
一套用于处理流的接口,以及一个内存实现。
安装
使用 Composer
composer require meekframework/stream
使用方法
使用接口
// write to stdout... class CliOutput implements Meek\Stream\Writable { public function write(string $data): int { // implementation here... } } // read from stdin... class CliInput implements Meek\Stream\Readable, Meek\Stream\Seekable { // implement methods from contracts... }
使用内存中的 Buffer
类
$stream = new Buffer('hello'); $stream->read(2); // returns 'he' $stream->getContents(); // returns 'llo' $stream->write(' world'); $stream->rewind(); $stream->getContents(); // returns 'hello world'
接口
- 双向
- 可锁定
- 可读
- 可寻址
- 转换
- 可写
贡献
查看 CONTRIBUTING.md.
致谢/作者
许可
MIT 许可证 (MIT)。请参阅 LICENSE.md 以获取更多信息。