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

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

thruster/stream
===============

Thruster Steam Component

1.2.0(10y ago)14563MITPHPPHP &gt;=7.0

Since Dec 12Pushed 10y ago1 watchersCompare

[ Source](https://github.com/ThrusterIO/stream)[ Packagist](https://packagist.org/packages/thruster/stream)[ Docs](https://thruster.io)[ RSS](/packages/thruster-stream/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (4)Versions (4)Used By (3)

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

[](#stream-component)

\[[![Latest Version](https://camo.githubusercontent.com/24e9231b10bb8e37cf0a7c55b5057f8508511d736f06146f665bea7c310f0347/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f5468727573746572494f2f73747265616d2e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/24e9231b10bb8e37cf0a7c55b5057f8508511d736f06146f665bea7c310f0347/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f5468727573746572494f2f73747265616d2e7376673f7374796c653d666c61742d737175617265)\] () \[[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)\] (LICENSE) \[[![Build Status](https://camo.githubusercontent.com/bf944a4d1864e7040251d7318a68a8c3bce19198c7579529aae60ab4a718c505/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f5468727573746572494f2f73747265616d2e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/bf944a4d1864e7040251d7318a68a8c3bce19198c7579529aae60ab4a718c505/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f5468727573746572494f2f73747265616d2e7376673f7374796c653d666c61742d737175617265)\] () \[[![Code Coverage](https://camo.githubusercontent.com/9cdb1bd961d9933bad4ba94e6da9afb12c9745338e83294744474b5ad5ef7602/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f5468727573746572494f2f73747265616d2e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/9cdb1bd961d9933bad4ba94e6da9afb12c9745338e83294744474b5ad5ef7602/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f5468727573746572494f2f73747265616d2e7376673f7374796c653d666c61742d737175617265)\] () \[[![Quality Score](https://camo.githubusercontent.com/79fe3c066c822d07771a4d3f5867a033b409109f897c27d0a6d07e6caeccd972/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f5468727573746572494f2f73747265616d2e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/79fe3c066c822d07771a4d3f5867a033b409109f897c27d0a6d07e6caeccd972/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f5468727573746572494f2f73747265616d2e7376673f7374796c653d666c61742d737175617265)\] () \[[![Total Downloads](https://camo.githubusercontent.com/e360e8b857a0d7715500bbaa8f79305c5b4a91ad475c8dff997ea8621b72c988/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74687275737465722f73747265616d2e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/e360e8b857a0d7715500bbaa8f79305c5b4a91ad475c8dff997ea8621b72c988/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74687275737465722f73747265616d2e7376673f7374796c653d666c61742d737175617265)\] ()

\[[![Email](https://camo.githubusercontent.com/fc4998410b6b71d697bf556c37294970fedc130c081c82698cdb5ca22d70cade/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f656d61696c2d7465616d4074687275737465722e696f2d626c75652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/fc4998410b6b71d697bf556c37294970fedc130c081c82698cdb5ca22d70cade/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f656d61696c2d7465616d4074687275737465722e696f2d626c75652e7376673f7374796c653d666c61742d737175617265)\] ()

The Thruster Stream Component.

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.

Install
-------

[](#install)

Via Composer

```
$ composer require thruster/stream
```

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.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

License
-------

[](#license)

Please see [License File](LICENSE) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

3

Last Release

3764d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/770bae1f46ac2b4536db820b8642491c25e2e2fd44e761110269e4722679a80d?d=identicon)[aurimasniekis](/maintainers/aurimasniekis)

---

Tags

streamthruster

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[react/stream

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

688126.8M194](/packages/react-stream)[trafficcophp/bytebuffer

Node.js inspired byte stream buffer for PHP.

33437.2k17](/packages/trafficcophp-bytebuffer)[markrogoyski/itertools-php

Iteration tools for PHP

14911.3k](/packages/markrogoyski-itertools-php)[alexandre-daubois/lazy-stream

Write data to streams, only when it is really needed to.

755.7k](/packages/alexandre-daubois-lazy-stream)

PHPackages © 2026

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