PHP code example of kennedytedesco / simple-stream-filter

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

    

kennedytedesco / simple-stream-filter example snippets




use KennedyTedesco\SimpleStreamFilter\Filter;

$stream = \fopen('file.txt', 'rb');

Filter::append($stream, static function ($chunk = null) {
    return \strip_tags($chunk);
});

\fpassthru($stream);

\fclose($stream);



use KennedyTedesco\SimpleStreamFilter\Filter;

final class StripTagsFilter
{
    public function __invoke($chunk)
    {
        return \strip_tags($chunk);
    }
}

$stream = \fopen('file.txt', 'rb');

Filter::append($stream, new StripTagsFilter);

\fpassthru($stream);

\fclose($stream);