Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/saksmt/php-streams

Another abstraction over output.
https://github.com/saksmt/php-streams

Last synced: about 2 months ago
JSON representation

Another abstraction over output.

Awesome Lists containing this project

README

        

smt/streams
===========

Another abstraction over output.

Key-features
------------

Redirecting to another stream.

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"