PHP code example of pastuhov / php-file-stream

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

    

pastuhov / php-file-stream example snippets



    $stream = new FileStream(
        '/tmp/export.yml'
    );

    $stream->write('<yml_catalog date="2010-04-01 17:00">');
    
    ...
    
    $stream->write('</yml_catalog>');


    $stream = new FileStream(
        '/tmp/sitemap{count}.xml',
        '<urlset>',
        '</urlset>',
        10000
    );

    foreach ($urls as $url) {
        $stream->write(
            '<url><loc>' . $url . '</loc></url>' . PHP_EOL
        );
    }

 bash
$ composer