PSR-7 StreamInterface implementation collection
Run through composer
$ composer require juhara/zzzstream
StringStream
string-based StreamInterface implementation.ReadOnlyStringStream
read-only string-based StreamInterface implementation.WriteOnlyStringStream
write-only string-based StreamInterface implementation.WrapperStream
decorator class that implements StreamInterface which does nothing except wraps other StreamInterface instance.ReadOnlyStream
decorator class that turn other StreamInterface into read only stream.WriteOnlyStream
decorator class that turn other StreamInterface into write only stream.FileStream
file-based StreamInterface implementation.TempStream
temporary stream StreamInterface implementation.
<?php
use Juhara\ZzzStream\StringStream;
...
$stream = new StringStream('hello world');
//replace PSR-7 ResponseInterface instance with new body
$newResponse = $response->withBody($stream);
<?php
use Juhara\ZzzStream\ReadOnlyStringStream;
...
$stream = new ReadOnlyStringStream('hello world');
//replace PSR-7 ResponseInterface instance with new body
$newResponse = $response->withBody($stream);
<?php
use Juhara\ZzzStream\StringStream;
use Juhara\ZzzStream\ReadOnlyStream;
...
$stream = new ReadOnlyStream(new StringStream('hello world'));
//replace PSR-7 ResponseInterface instance with new body
$newResponse = $response->withBody($stream);
To run unit test, copy phpunit.xml.dist
to phpunit.xml
and run
$ ./vendor/bin/phpunit
If you have any improvement or issues please submit PR.
Thank you.