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

ActiveLibrary

catapush/streamer
=================

Object-oriented API to PHP streams

v1.0(6y ago)01.7k↓100%1MITPHPPHP &gt;=5.3.0

Since Aug 9Pushed 6y agoCompare

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

READMEChangelog (1)DependenciesVersions (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:

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

Example
-------

[](#example)

```
