webarchitect609 / stream-tools
Useful filters and other tools to be used with PHP Stream Functions.
Installs: 1 051
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.2 || ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2024-11-04 13:04:29 UTC
README
Be careful: it's the early alpha-version so far!
Useful filters and other tools to be used with PHP Stream Functions.
How to use
-
Install via composer
composer require webarchitect609/stream-tools
-
Register the desired filter.
use WebArch\StreamTools\Filter\EndOfLineFilter; stream_filter_register(EndOfLineFilter::class, EndOfLineFilter::class);
-
See the filter's phpDocs for help on usage and params. Attach the filter to the opened file resource or other stream.
use WebArch\StreamTools\Enum\EndOfLine; use WebArch\StreamTools\Filter\EndOfLineFilter; /** @var resource $stream */ stream_filter_append( $stream, EndOfLineFilter::class, STREAM_FILTER_WRITE, EndOfLine::WINDOWS );
-
Enjoy!
/** @var resource $stream */ fputs($stream, "All LF symbols\nwill be replaced by CRLF symbols.\nThat's it!");