PHPackages                             rx/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. rx/stream

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rx/stream
=========

Async Stream for RxPHP

3.0.2(6y ago)32.3k21MITPHPPHP ^7.0CI failing

Since Jan 23Pushed 6y ago2 watchersCompare

[ Source](https://github.com/RxPHP/RxStream)[ Packagist](https://packagist.org/packages/rx/stream)[ RSS](/packages/rx-stream/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (5)Versions (12)Used By (1)

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

[](#stream-component)

Provides RxPHP Observables for PHP streams

This library is a wrapper around the [ReactPHP](https://github.com/reactphp/stream) stream library. It uses the [Voryx event-loop](https://github.com/voryx/event-loop) which behaves like the Javascript event-loop. ie. You don't need to start it.

Usage
-----

[](#usage)

### From File

[](#from-file)

```

    $source = new \Rx\React\FromFileObservable("example.csv");

    $source
        ->cut() //Cut the stream by PHP_EOL
        ->map('str_getcsv') //Convert csv row to an array
        ->map(function (array $row) {
            //Strip numbers from the first field
            $row[0] = preg_replace('/\d+/u', '', $row[0]);
            return $row;
        })
        ->subscribe(
            function ($data) {
                echo $data[0] . "\n";
            },
            function ($e) {
                echo "error\n";
            },
            function () {
                echo "done\n";
            }
        );

```

### Read and Write to File

[](#read-and-write-to-file)

```
$source = new \Rx\React\FromFileObservable("source.txt");
$dest   = new \Rx\React\ToFileObserver("dest.txt");

$source
    ->cut()
    ->filter(function ($row) {
        return strpos($row, 'foo');
    })
    ->map(function ($row) {
        return $row . 'bar';
    })
    ->subscribe($dest);
```

### Stream - echo example

[](#stream---echo-example)

```
$read  = new \Rx\React\StreamSubject(STDIN);

$read
    ->takeWhile(function ($x) {
        return trim($x) != 15;
    })
    ->subscribe(new \Rx\React\StreamSubject(STDOUT));

```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 95% of commits — single point of failure

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 ~156 days

Recently: every ~285 days

Total

11

Last Release

2248d ago

Major Versions

0.2.1 → 2.0.02017-01-05

2.0.3 → 3.0.02017-12-19

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/748287?v=4)[Matt Bonneau](/maintainers/mbonneau)[@mbonneau](https://github.com/mbonneau)

![](https://avatars.githubusercontent.com/u/4969183?v=4)[David Dan](/maintainers/davidwdan)[@davidwdan](https://github.com/davidwdan)

---

Top Contributors

[![davidwdan](https://avatars.githubusercontent.com/u/4969183?v=4)](https://github.com/davidwdan "davidwdan (19 commits)")[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (1 commits)")

---

Tags

streamreactphpreactrx.phpreactivex

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k251.2M24.7k](/packages/friendsofphp-php-cs-fixer)[react/stream

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

691146.0M209](/packages/react-stream)[react/react

ReactPHP: Event-driven, non-blocking I/O with PHP.

9.1k3.7M65](/packages/react-react)[react/child-process

Event-driven library for executing child processes with ReactPHP.

34691.0M157](/packages/react-child-process)[voryx/pgasync

Async Reactive Postgres Driver for PHP (Non-blocking)

11297.9k4](/packages/voryx-pgasync)[clue/utf8-react

Streaming UTF-8 parser, built on top of ReactPHP.

6611.0M4](/packages/clue-utf8-react)

PHPackages © 2026

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