PHPackages                             werkint/reactphp-stream - 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. werkint/reactphp-stream

Abandoned → [werkint/reactphp-stream](/?search=werkint%2Freactphp-stream)Library

werkint/reactphp-stream
=======================

Basic readable and writable stream interfaces that support piping.

v0.4.4(9y ago)01.4kMITPHPPHP &gt;=5.3.8

Since Jul 11Pushed 9y ago4 watchersCompare

[ Source](https://github.com/Werkint/stream)[ Packagist](https://packagist.org/packages/werkint/reactphp-stream)[ RSS](/packages/werkint-reactphp-stream/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (4)Versions (30)Used By (0)

Stream Component
================

[](#stream-component)

[![Build Status](https://camo.githubusercontent.com/c87b232deebf549cc01b800846ed734cec11bf872a98413f1a951544e72687df/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f72656163747068702f73747265616d2e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/reactphp/stream)

Basic readable and writable stream interfaces that support piping.

In order to make the event loop easier to use, this component introduces the concept of streams. They are very similar to the streams found in PHP itself, but have an interface more suited for async I/O.

Mainly it provides interfaces for readable and writable streams, plus a file descriptor based implementation with an in-memory write buffer.

This component depends on `événement`, which is an implementation of the `EventEmitter`.

Readable Streams
----------------

[](#readable-streams)

### EventEmitter Events

[](#eventemitter-events)

- `data`: Emitted whenever data was read from the source.
- `end`: Emitted when the source has reached the `eof`.
- `error`: Emitted when an error occurs.
- `close`: Emitted when the connection is closed.

### Methods

[](#methods)

- `isReadable()`: Check if the stream is still in a state allowing it to be read from. It becomes unreadable when the connection ends, closes or an error occurs.
- `pause()`: Remove the data source file descriptor from the event loop. This allows you to throttle incoming data.
- `resume()`: Re-attach the data source after a `pause()`.
- `pipe(WritableStreamInterface $dest, array $options = [])`: Pipe this readable stream into a writable stream. Automatically sends all incoming data to the destination. Automatically throttles based on what the destination can handle.

Writable Streams
----------------

[](#writable-streams)

### EventEmitter Events

[](#eventemitter-events-1)

- `drain`: Emitted if the write buffer became full previously and is now ready to accept more data.
- `error`: Emitted whenever an error occurs.
- `close`: Emitted whenever the connection is closed.
- `pipe`: Emitted whenever a readable stream is `pipe()`d into this stream.

### Methods

[](#methods-1)

- `isWritable()`: Check if the stream can still be written to. It cannot be written to after an error or when it is closed.
- `write($data)`: Write some data into the stream. If the stream cannot handle it, it should buffer the data or emit and `error` event. If the internal buffer is full after adding `$data`, `write` should return false, indicating that the caller should stop sending data until the buffer `drain`s.
- `end($data = null)`: Optionally write some final data to the stream, empty the buffer, then close it.

Usage
-----

[](#usage)

```
    $loop = React\EventLoop\Factory::create();

    $source = new React\Stream\Stream(fopen('omg.txt', 'r'), $loop);
    $dest = new React\Stream\Stream(fopen('wtf.txt', 'w'), $loop);

    $source->pipe($dest);

    $loop->run();
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~88 days

Recently: every ~233 days

Total

18

Last Release

3553d ago

PHP version history (4 changes)v0.1.0PHP &gt;=5.3.2

v0.2.0PHP &gt;=5.3.3

v0.4.0PHP &gt;=5.4.0

v0.4.4PHP &gt;=5.3.8

### Community

Maintainers

![](https://www.gravatar.com/avatar/533d0c99c4e0c7413a1dcce2d81c37ecf94883e6377d274d6f43247a399bb268?d=identicon)[nick4fake](/maintainers/nick4fake)

---

Top Contributors

[![igorw](https://avatars.githubusercontent.com/u/88061?v=4)](https://github.com/igorw "igorw (43 commits)")[![cboden](https://avatars.githubusercontent.com/u/617694?v=4)](https://github.com/cboden "cboden (43 commits)")[![clue](https://avatars.githubusercontent.com/u/776829?v=4)](https://github.com/clue "clue (38 commits)")[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (5 commits)")[![steverhoades](https://avatars.githubusercontent.com/u/1146668?v=4)](https://github.com/steverhoades "steverhoades (4 commits)")[![bohdanly](https://avatars.githubusercontent.com/u/1250142?v=4)](https://github.com/bohdanly "bohdanly (3 commits)")[![arnaud-lb](https://avatars.githubusercontent.com/u/365207?v=4)](https://github.com/arnaud-lb "arnaud-lb (3 commits)")[![jmalloc](https://avatars.githubusercontent.com/u/761536?v=4)](https://github.com/jmalloc "jmalloc (2 commits)")[![jsor](https://avatars.githubusercontent.com/u/55574?v=4)](https://github.com/jsor "jsor (2 commits)")[![DaveRandom](https://avatars.githubusercontent.com/u/2396425?v=4)](https://github.com/DaveRandom "DaveRandom (1 commits)")

---

Tags

streampipe

### Embed Badge

![Health badge](/badges/werkint-reactphp-stream/health.svg)

```
[![Health](https://phpackages.com/badges/werkint-reactphp-stream/health.svg)](https://phpackages.com/packages/werkint-reactphp-stream)
```

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.0B3.2k](/packages/guzzlehttp-psr7)[react/stream

Event-driven readable and writable streams for non-blocking I/O in ReactPHP

688126.8M194](/packages/react-stream)[react/socket

Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP

1.3k116.9M402](/packages/react-socket)[maennchen/zipstream-php

ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.

1.9k286.3M147](/packages/maennchen-zipstream-php)[clue/stream-filter

A simple and modern approach to stream filtering in PHP

1.7k261.7M7](/packages/clue-stream-filter)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.1k57.6M131](/packages/openspout-openspout)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
