Object-Oriented API for PHP streams (PSR-7 compatible).
composer require crysalead/storage-streamuse Lead\Storage\Stream;
$stream = new Stream(fopen('smiley.png', 'r'));
$image = '';
while (!$stream->eof()) {
$image .= $stream->read();
}
echo $stream->mime(); // 'image/png'use Lead\Storage\Stream;
$stream1 = new Stream("Hello");
$stream2 = new Stream("xxxxxWorld");
// copy the contents from the first stream to the second one
$stream1->pipe($stream2);
echo (string) $stream2; // 'HelloWorld'Original implementation: Francois Zaninotto.

