PHP code example of meekframework / stream
1. Go to this page and download the library: Download meekframework/stream library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
meekframework / stream example snippets
// 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...
}
$stream = new Buffer('hello');
$stream->read(2); // returns 'he'
$stream->getContents(); // returns 'llo'
$stream->write(' world');
$stream->rewind();
$stream->getContents(); // returns 'hello world'