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

Abandoned → [toalett/react-stream-adapter](/?search=toalett%2Freact-stream-adapter)Library[Utility &amp; Helpers](/categories/utility)

joopschilder/reactphp-input-stream
==================================

Wraps a non-blocking input to behave like a stream so it can be used in a ReactPHP EventLoop

v0.1(6y ago)0131MITPHPPHP ^7.4

Since Feb 8Pushed 6y ago1 watchersCompare

[ Source](https://github.com/joopschilder/reactphp-input-stream)[ Packagist](https://packagist.org/packages/joopschilder/reactphp-input-stream)[ RSS](/packages/joopschilder-reactphp-input-stream/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (2)Versions (2)Used By (1)

`reactphp-input-stream`
=======================

[](#reactphp-input-stream)

What is this?
-------------

[](#what-is-this)

A compact library that can wrap a non-blocking input to behave like a [stream](https://reactphp.org/stream/) in a [ReactPHP EventLoop](https://reactphp.org/event-loop/).

How do I use this?
------------------

[](#how-do-i-use-this)

Check out the `examples` folder. It contains a very basic example of a non-blocking input implementation, as well as a very (*very*) lame joke generator.

Why is this useful?
-------------------

[](#why-is-this-useful)

I needed to respond to incoming AMQP messages in my event loop and I was feeling adventurous.
Admittedly, I could have just used a periodic timer directly (that is what this library uses under the hood), but where's the fun in that?

I hear you ask: "*Where's the code that deals with the AMQP messages*?"
While I was writing this, I felt like it would be useful to separate the logic of dealing with input in a stream-like manner from the logic that deals with AMQP messages.
This means you can reuse this library to map practically anything to a readable stream.
An extra-lame example of this can be found in `examples/jokes_example.php`.

When the code for AMQP consumption as stream is finished, I will link it here.

Where are the unit tests?
-------------------------

[](#where-are-the-unit-tests)

*Errrrrr...*

How do I install this?
----------------------

[](#how-do-i-install-this)

This should do it [once it's available on Packagist](https://packagist.org/packages/joopschilder/):

```
composer require joopschilder/reactphp-input-stream
```

Mandatory block of example code
-------------------------------

[](#mandatory-block-of-example-code)

```
// Say, we have an event loop...
$loop = Factory::create();

// And say, we have a non-blocking input called $input...
$input = new DemoNonBlockingInput();

// Then we can create a ReadableStream from it like so:
$stream = new ReadableNonBlockingInputStream($input, $loop);

// If your 'select()' method takes a long time to execute, or you just don't
// feel like polling the input availability that often, you can
// set a custom polling interval by supplying an instance of PollingInterval
// as the third constructor parameter:
$lowPollingStream = new ReadableNonBlockingInputStream($input, $loop, new PollingInterval(5));

// Of course, the stream emits all expected events (except end)
$stream->on('data', fn() => print('m'));
$stream->on('error', fn() => print('e'));
$stream->on('close', fn() => print('c'));

// If you know what data your input returns, you may type-hint it:
$stream->on('data', fn(Joke $joke) => print($joke . PHP_EOL));

// Add a periodic timer for demonstration purposes
$loop->addPeriodicTimer(0.2, fn() => print('.'));

// And kick 'er off.
$loop->run();
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2291d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/354e41b4e3f076892667d134069d733b8ece2f4879904c0638eb40500332a8e6?d=identicon)[Joop Schilder](/maintainers/Joop%20Schilder)

---

Top Contributors

[![joopschilder](https://avatars.githubusercontent.com/u/23739275?v=4)](https://github.com/joopschilder "joopschilder (2 commits)")

### Embed Badge

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

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

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k234.7M20.6k](/packages/friendsofphp-php-cs-fixer)[react/react

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

9.1k3.6M63](/packages/react-react)[react/child-process

Event-driven library for executing child processes with ReactPHP.

34076.1M136](/packages/react-child-process)[react/stream

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

688126.8M194](/packages/react-stream)[llm/mcp-server

PHP SDK for building MCP servers

431.1k](/packages/llm-mcp-server)

PHPackages © 2026

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