PHPackages                             deminy/streamer - 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. deminy/streamer

AbandonedArchivedLibrary

deminy/streamer
===============

Object-oriented API to PHP streams

0.0.1(11y ago)01.5k—0%11MITPHPPHP &gt;=5.3.0

Since Dec 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/deminy/Streamer)[ Packagist](https://packagist.org/packages/deminy/streamer)[ Docs](https://github.com/deminy/Streamer)[ RSS](/packages/deminy-streamer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (1)

Streamer
========

[](#streamer)

Streamer is an Object-Oriented API for PHP streams.

Why should I use Streams?
-------------------------

[](#why-should-i-use-streams)

A stream is a flow of bytes from one container to the other. You already use streams a lot in PHP, for instance each time you load a file into memory (`file_get_contents()`). You should explicitly use streams each time that:

- You need to access data from a container, but you don't know the size of this container (e.g. reading from STDIN, or a web service using streaming)
- You need to start processing data from a container before the whole transfer is finished (e.g. start zipping a file before it's all in memory)
- You need to save time and memory

What is Streamer?
-----------------

[](#what-is-streamer)

PHP has a very elaborate stream API ; unfortunately, it uses functions for most stream operations (except for wrappers - go figure). Streamer is a generic library focusing on offering an object-oriented API to streams, and only that.

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

[](#installation)

Streamer is published on [packagist.org](http://packagist.org/packages/deminy/streamer), so you can add it to your `composer.json` file for an easy installation:

```
composer require deminy/streamer
```

or

```
{
    "require": {
        "deminy/streamer": "@dev"
    }
}
```

Example
-------

[](#example)

```
