PHPackages                             mracine/php-streams - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. mracine/php-streams

ActiveLibrary

mracine/php-streams
===================

Streams abstraction library

v0.3.0(2y ago)01241MITPHPPHP ^7.0|^8.0

Since Mar 24Pushed 2y ago1 watchersCompare

[ Source](https://github.com/matracine/php-streams)[ Packagist](https://packagist.org/packages/mracine/php-streams)[ RSS](/packages/mracine-php-streams/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (6)Used By (1)

[![Latest Stable Version](https://camo.githubusercontent.com/801b1b43aa1daf31045aaeb8d3e7a90ef2989f25960924b5518001c375dd0b12/68747470733a2f2f706f7365722e707567782e6f72672f6d726163696e652f7068702d73747265616d732f762f737461626c65)](https://packagist.org/packages/mracine/php-streams)[![PHP 7 ready](https://camo.githubusercontent.com/324b21be004bcc782c83b544a9d1fa0954b754f40fb8618b5a548b7b86a3e57b/68747470733a2f2f7068703772656164792e74696d6573706c696e7465722e63682f6d6174726163696e652f7068702d73747265616d732f6d61737465722f62616467652e737667)](https://travis-ci.org/matracine/php-streams)[![License](https://camo.githubusercontent.com/10ead893b9618295b912380934be8f82c617c27cd438dbd657c682ee43e843bb/68747470733a2f2f706f7365722e707567782e6f72672f6d726163696e652f7068702d73747265616d732f6c6963656e7365)](https://packagist.org/packages/mracine/php-streams)[![Travis Build Status](https://camo.githubusercontent.com/da15960dbb259e638954ed55cadb725236414ec57a7f128866c40a5f5a90ed74/68747470733a2f2f7472617669732d63692e6f72672f6d6174726163696e652f7068702d73747265616d732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/matracine/php-streams)[![Scrutinizer Build Status](https://camo.githubusercontent.com/f19c3a83def8cd5b04b81d2a79832e1cd6eafa6c3689eb2a842bac547c167a49/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6174726163696e652f7068702d73747265616d732f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/matracine/php-streams/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/eb595dfe086da67a629adf802460db15ea7a6b5027059dcb44ea6dae765bf66c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6174726163696e652f7068702d73747265616d732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/matracine/php-streams/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/d557db05cf9aafa9a49a96fc72b5a759cf3d5264670125d5bb782111899e0478/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6174726163696e652f7068702d73747265616d732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/matracine/php-streams/?branch=master)[![Code Intelligence Status](https://camo.githubusercontent.com/e8c4d5c2038892d593efff68f930306868f39494106fd53ae97170cd18b9421e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6174726163696e652f7068702d73747265616d732f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)[![Maintainability](https://camo.githubusercontent.com/0a6c77a16e1e6e6f18445159f09af92b70f5b3a35154e58f4495bd692a3b3f39/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f65366431373262313063336631326531626233352f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/matracine/php-streams/maintainability)

PHP STREAMS ABSTRACTION LIBRARY
===============================

[](#php-streams-abstraction-library)

**mracine\\Streams** is a library that provide streams abstraction to use differents kind of resources (files, sockets, pipes, process input/output, strings) as streams provider. It makes testing simple for classes which use the mracine\\Sreams\\Stream interface.

Installation
------------

[](#installation)

You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):

```
composer require mracine/streams

```

Usage
-----

[](#usage)

The mracine\\Streams\\Stream interface provides :

- read method : get bytes from a stream
- write method : push bytes to a stream
- close method : release the stream

There are actualy two classes implementing the Stream interface :

- mracine\\Streams\\ResourceStream : abstract a PHP resource (fils, socket, UNIX pipes, process....)
- mracine\\Streams\\BufferStream : abstract a PHP string in a buffer

```
