library streams
Another abstraction over output
smt/streams
Another abstraction over output
- Tuesday, August 11, 2015
- by smt
- Repository
- 1 Watchers
- 0 Stars
- 6 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
smt/streams
Another abstraction over output., (*1)
Key-features
Redirecting to another stream., (*2)
Installation
composer require smt/streams
Usage
use Smt\Streams\SymfonyOutputStream;
use Smt\Streams\FileStream;
use Smt\Streams\DummyStream;
$outStream = new SymfonyOutputStream($out);
$outStream
->write('Hello')
->redirect(new FileStream('truth.txt'))
->write('Time')
->write(' to')
->write(' take')
->write(' over')
->write(' the')
->setRedirectMode(FileStream::WRITE_REDIRECT)
->writeln('world')
;
// Symfony out - "Hello world"
// truth.txt - "Time to take over the world"