PHP code example of componenta / stream-iterator

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

    

componenta / stream-iterator example snippets


use Componenta\Stdlib\StreamIterator;

$iterator = new StreamIterator($stream, bytesPerIteration: 1024);

foreach ($iterator as $offset => $chunk) {
    // $offset is the stream position where the chunk started.
}