PHP code example of kjljon / streamingiterable

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

    

kjljon / streamingiterable example snippets


$iterable = [
    ['first' => 'Jim', 'last' => 'Thompson', 'month' => 'April'],
    ['first' => 'Tim', 'last' => 'Johnson', 'month' => 'December']
];

$formatter = new KJLJon\StreamingIterable\Formatter\CsvFormatter();
$stream = new KJLJon\StreamingIterable\IterableToReaderStream($iterable, $formatter);
$fp = KJLJon\StreamingIterable\StreamWrapper::getResource($stream);

//do something with stream (IE: flyweight's writeStream($location, $fp);
fpassthru($fp);

fclose($fp);