https://github.com/webarchitect609/stream-tools
Useful filters and other tools to be used with PHP Stream Functions.
https://github.com/webarchitect609/stream-tools
Last synced: 3 months ago
JSON representation
Useful filters and other tools to be used with PHP Stream Functions.
- Host: GitHub
- URL: https://github.com/webarchitect609/stream-tools
- Owner: webarchitect609
- Created: 2020-03-12T09:32:18.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-07-04T12:22:12.000Z (almost 2 years ago)
- Last Synced: 2025-11-27T16:46:19.135Z (7 months ago)
- Language: PHP
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
Stream Tools
===============
**Be careful**: it's the early alpha-version so far!
[](https://travis-ci.org/webarchitect609/stream-tools)
Useful filters and other tools to be used with [PHP Stream Functions](https://www.php.net/manual/en/ref.stream.php).
How to use
----------
1) Install via [composer](https://getcomposer.org/)
```bash
composer require webarchitect609/stream-tools
```
2) Register the desired filter.
```php
use WebArch\StreamTools\Filter\EndOfLineFilter;
stream_filter_register(EndOfLineFilter::class, EndOfLineFilter::class);
```
3) See the filter's phpDocs for help on usage and params. Attach the filter to the opened file resource or other stream.
```php
use WebArch\StreamTools\Enum\EndOfLine;
use WebArch\StreamTools\Filter\EndOfLineFilter;
/** @var resource $stream */
stream_filter_append(
$stream,
EndOfLineFilter::class,
STREAM_FILTER_WRITE,
EndOfLine::WINDOWS
);
```
4) Enjoy!
```php
/** @var resource $stream */
fputs($stream, "All LF symbols\nwill be replaced by CRLF symbols.\nThat's it!");
```