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: 2025-01-05 07:16:35 UTC
README
A set of interfaces for working with streams, as well as an in-memory implementation.
Installation
With Composer:
composer require meekframework/stream
Usage
Using the interfaces:
// 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... }
Using the in-memory Buffer
class:
$stream = new Buffer('hello'); $stream->read(2); // returns 'he' $stream->getContents(); // returns 'llo' $stream->write(' world'); $stream->rewind(); $stream->getContents(); // returns 'hello world'
Interfaces
- Duplex
- Lockable
- Readable
- Seekable
- Transform
- Writable
Contributing
See CONTRIBUTING.md.
Credits/Authors
License
The MIT License (MIT). Please see LICENSE.md for more information.