v1.0.0 2017-11-10 13:14 UTC

This package is not auto-updated.

Last update: 2024-05-26 03:33:09 UTC


README

Scrutinizer Build Status Scrutinizer Code Quality Scrutinizer Code Coverage Packagist Latest Stable Version MIT License

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.