PHP code example of crysalead / storage-stream

1. Go to this page and download the library: Download crysalead/storage-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/ */

    

crysalead / storage-stream example snippets


use 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'