react/stream
Event-driven readable and writable streams for non-blocking I/O in ReactPHP
v1.4.0
159M downloads/mo
#169 most downloaded on composer
reactphp/stream
What this package is like to depend on
Last release 2 years ago
no release in 18 months
Release timing varies
gaps range from 4 weeks to 1.9 years
Nearly every release is documented
notes for 37 of 37 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
37 releases · first in 2012
0 releases in the last 12 months
see the full history below
Release timeline
37 releases · Jul 2012 to Jun 2024Releases
latest 37-
v1.4.011 Jun 2024 -
v1.3.016 Jun 2023Release notes
Open source →-
Feature: Full PHP 8.1 and PHP 8.2 compatibility.
(#160 by @SimonFrings, #165 by @clue and #169 by @WyriHaximus) -
Feature: Avoid unneeded syscall when creating non-blocking
DuplexResourceStream.
(#164 by @clue) -
Minor documentation improvements.
(#161 by @mrsimonbennett, #162 by @SimonFrings and #166 by @nhedger) -
Improve test suite and project setup and report failed assertions.
(#168 and #170 by @clue and #163 by @SimonFrings)
Release notes
Open source →-
Feature: Full PHP 8.1 and PHP 8.2 compatibility. (#160 by @SimonFrings, #165 by @clue and #169 by @WyriHaximus)
-
Feature: Avoid unneeded syscall when creating non-blocking
DuplexResourceStream. (#164 by @clue) -
Minor documentation improvements. (#161 by @mrsimonbennett, #162 by @SimonFrings and #166 by @nhedger)
-
Improve test suite and project setup and report failed assertions. (#168 and #170 by @clue and #163 by @SimonFrings)
-
-
v1.2.011 Jul 2021Release notes
Open source →A major new feature release, see release announcement.
-
Feature: Simplify usage by supporting new default loop.
(#159 by @clue)// old (still supported) $stream = new ReadableResourceStream($resource, $loop); $stream = new WritabeResourceStream($resource, $loop); $stream = new DuplexResourceStream($resource, $loop); // new (using default loop) $stream = new ReadableResourceStream($resource); $stream = new WritabeResourceStream($resource); $stream = new DuplexResourceStream($resource);
-
Improve test suite, use GitHub actions for continuous integration (CI),
update PHPUnit config, run tests on PHP 8 and add full core team to the license.
(#153, #156 and #157 by @SimonFrings and #154 by @WyriHaximus)
Release notes
Open source →A major new feature release, see release announcement.
-
Feature: Simplify usage by supporting new default loop. (#159 by @clue)
// old (still supported) $stream = new ReadableResourceStream($resource, $loop); $stream = new WritabeResourceStream($resource, $loop); $stream = new DuplexResourceStream($resource, $loop); // new (using default loop) $stream = new ReadableResourceStream($resource); $stream = new WritabeResourceStream($resource); $stream = new DuplexResourceStream($resource); -
Improve test suite, use GitHub actions for continuous integration (CI), update PHPUnit config, run tests on PHP 8 and add full core team to the license. (#153, #156 and #157 by @SimonFrings and #154 by @WyriHaximus)
-
-
v1.1.104 May 2020Release notes
Open source →-
Fix: Fix faulty write buffer behavior when sending large data chunks over TLS (Mac OS X only).
(#150 by @clue) -
Minor code style improvements to fix phpstan analysis warnings and
add.gitattributesto exclude dev files from exports.
(#140 by @flow-control and #144 by @reedy) -
Improve test suite to run tests on PHP 7.4 and simplify test matrix.
(#147 by @clue)
Release notes
Open source →-
Fix: Fix faulty write buffer behavior when sending large data chunks over TLS (Mac OS X only). (#150 by @clue)
-
Minor code style improvements to fix phpstan analysis warnings and add
.gitattributesto exclude dev files from exports. (#140 by @flow-control and #144 by @reedy) -
Improve test suite to run tests on PHP 7.4 and simplify test matrix. (#147 by @clue)
-
-
v1.1.001 Jan 2019Release notes
Open source →-
Improvement: Increase performance by optimizing global function and constant look ups.
(#137 by @WyriHaximus) -
Travis: Test against PHP 7.3.
(#138 by @WyriHaximus) -
Fix: Ignore empty reads.
(#139 by @WyriHaximus)
Release notes
Open source →-
Improvement: Increase performance by optimizing global function and constant look ups. (#137 by @WyriHaximus)
-
Travis: Test against PHP 7.3. (#138 by @WyriHaximus)
-
Fix: Ignore empty reads. (#139 by @WyriHaximus)
-
-
v1.0.011 Jul 2018Release notes
Open source →- First stable LTS release, now following SemVer.
We'd like to emphasize that this component is production ready and battle-tested.
We plan to support all long-term support (LTS) releases for at least 24 months,
so you have a rock-solid foundation to build on top of.
Contains no other changes, so it's actually fully compatible with the v0.7.7 release.
Release notes
Open source →- First stable LTS release, now following SemVer. We'd like to emphasize that this component is production ready and battle-tested. We plan to support all long-term support (LTS) releases for at least 24 months, so you have a rock-solid foundation to build on top of.
Contains no other changes, so it's actually fully compatible with the v0.7.7 release.
- First stable LTS release, now following SemVer.
-
v0.7.719 Jan 2018Release notes
Open source →- Improve test suite by fixing forward compatibility with upcoming EventLoop releases, avoid risky tests and add test group to skip integration tests relying on internet connection and apply appropriate test timeouts. (#128, #131 and #132 by @clue)
-
v0.7.621 Dec 2017Release notes
Open source →-
Fix: Work around reading from unbuffered pipe stream in legacy PHP < 5.4.28 and PHP < 5.5.12 (#126 by @clue)
-
Improve test suite by simplifying test bootstrapping logic via Composer and test against PHP 7.2 (#127 by @clue and #124 by @carusogabriel)
-
-
v0.7.520 Nov 2017Release notes
Open source →-
Fix: Igore excessive
fopen()mode flags forWritableResourceStream
(#119 by @clue) -
Fix: Fix forward compatibility with upcoming EventLoop releases
(#121 by @clue) -
Restructure examples to ease getting started
(#123 by @clue) -
Improve test suite by adding forward compatibility with PHPUnit 6 and
ignore Mac OS X test failures for now until Travis tests work again
(#122 by @Gabriel-Caruso and #120 by @clue)
Release notes
Open source →-
Fix: Igore excessive
fopen()mode flags forWritableResourceStream(#119 by @clue) -
Fix: Fix forward compatibility with upcoming EventLoop releases (#121 by @clue)
-
Restructure examples to ease getting started (#123 by @clue)
-
Improve test suite by adding forward compatibility with PHPUnit 6 and ignore Mac OS X test failures for now until Travis tests work again (#122 by @gabriel-caruso and #120 by @clue)
-
-
v0.7.411 Oct 2017Release notes
Open source →-
Fix: Remove event listeners from
CompositeStreamonce closed and
remove undocumented left-overcloseevent argument
(#116 by @clue) -
Minor documentation improvements: Fix wrong class name in example,
fix typos in README and
fix forward compatibility with upcoming EventLoop releases in example
(#113 by @docteurklein and #114 and #115 by @clue) -
Improve test suite by running against Mac OS X on Travis
(#112 by @clue)
Release notes
Open source →-
Fix: Remove event listeners from
CompositeStreamonce closed and remove undocumented left-overcloseevent argument (#116 by @clue) -
Minor documentation improvements: Fix wrong class name in example, fix typos in README and fix forward compatibility with upcoming EventLoop releases in example (#113 by @docteurklein and #114 and #115 by @clue)
-
Improve test suite by running against Mac OS X on Travis (#112 by @clue)
-
-
v0.7.305 Aug 2017Release notes
Open source →-
Improvement: Support Événement 3.0 a long side 2.0 and 1.0 (#108 by @WyriHaximus)
-
Readme: Corrected loop initialization in usage example (#109 by @pulyavin)
-
Travis: Lock linux distribution preventing future builds from breaking (#110 by @clue)
-
-
v0.7.215 Jun 2017Release notes
Open source →- Bug fix: WritableResourceStream: Close the underlying stream when closing the stream. (#107 by @WyriHaximus)
-
v0.7.120 May 2017Release notes
Open source →-
Feature: Add optional
$writeChunkSizeparameter to limit maximum number of bytes to write at once. (#105 by @clue)$stream = new WritableResourceStream(STDOUT, $loop, null, 8192); -
Ignore HHVM test failures for now until Travis tests work again (#106 by @clue)
-
-
v0.7.004 May 2017Release notes
Open source →-
Removed / BC break: Remove deprecated and unneeded functionality (#45, #87, #90, #91 and #93 by @clue)
-
Remove deprecated
Streamclass, useDuplexResourceStreaminstead (#87 by @clue) -
Remove public
$bufferproperty, use new constructor parameters instead (#91 by @clue) -
Remove public
$streamproperty from all resource streams (#90 by @clue) -
Remove undocumented and now unused
ReadableStreamandWritableStream(#93 by @clue) -
Remove
BufferedSink(#45 by @clue)
-
-
Feature / BC break: Simplify
ThroughStreamby using data callback instead of inheritance. It is now a direct implementation ofDuplexStreamInterface. (#88 and #89 by @clue)$through = new ThroughStream(function ($data) { return json_encode($data) . PHP_EOL; }); $through->on('data', $this->expectCallableOnceWith("[2, true]\n")); $through->write(array(2, true)); -
Feature / BC break: The
CompositeStreamstarts closed if either side is already closed and forwards pause to pipe source on first write attempt. (#96 and #103 by @clue)If either side of the composite stream closes, it will also close the other side. We now also ensure that if either side is already closed during instantiation, it will also close the other side.
-
BC break: Mark all classes as
finaland mark internal API asprivateto discourage inheritance (#95 and #99 by @clue) -
Feature / BC break: Only emit
errorevent for fatal errors (#92 by @clue)The
errorevent was previously also allowed to be emitted for non-fatal errors, but our implementations actually only ever emitted this as a fatal error and then closed the stream. -
Feature: Explicitly allow custom events and exclude any semantics (#97 by @clue)
-
Strict definition for event callback functions (#101 by @clue)
-
Support legacy PHP 5.3 through PHP 7.1 and HHVM and improve usage documentation (#100 and #102 by @clue)
-
Actually require all dependencies so this is self-contained and improve forward compatibility with EventLoop v1.0 and v0.5 (#94 and #98 by @clue)
-
-
v0.6.026 Mar 2017Release notes
Open source →-
Feature / Fix / BC break: Add
DuplexResourceStreamand deprecateStream(#85 by @clue)// old (does still work for BC reasons) $stream = new Stream($connection, $loop); // new $stream = new DuplexResourceStream($connection, $loop);Note that the
DuplexResourceStreamnow rejects read-only or write-only streams, so this may affect BC. If you want a read-only or write-only resource, useReadableResourceStreamorWritableResourceStreaminstead ofDuplexResourceStream.BC note: This class was previously called
Stream. TheStreamclass still exists for BC reasons and will be removed in future versions of this package. -
Feature / BC break: Add
WritableResourceStream(previously calledBuffer) (#84 by @clue)// old $stream = new Buffer(STDOUT, $loop); // new $stream = new WritableResourceStream(STDOUT, $loop); -
Feature: Add
ReadableResourceStream(#83 by @clue)$stream = new ReadableResourceStream(STDIN, $loop); -
Fix / BC Break: Enforce using non-blocking I/O (#46 by @clue)
BC note: This is known to affect process pipes on Windows which do not support non-blocking I/O and could thus block the whole EventLoop previously.
-
Feature / Fix / BC break: Consistent semantics for
DuplexStreamInterface::end()to ensure it SHOULD also end readable side (#86 by @clue) -
Fix: Do not use unbuffered reads on pipe streams for legacy PHP < 5.4 (#80 by @clue)
-
-
v0.5.008 Mar 2017Release notes
Open source →-
Feature / BC break: Consistent
endevent semantics (EOF) (#70 by @clue)The
endevent will now only be emitted for a successful end, not if the stream closes due to an unrecoverableerrorevent or if you callclose()explicitly. If you want to detect when the stream closes (terminates), use thecloseevent instead. -
BC break: Remove custom (undocumented)
full-drainevent fromBuffer(#63 and #68 by @clue)The
full-drainevent was undocumented and mostly used internally. Relying on this event has attracted some low-quality code in the past, so we've removed this from the public API in order to work out a better solution instead. If you want to detect when the buffer finishes flushing data to the stream, you may want to look into itsend()method or thecloseevent instead. -
Feature / BC break: Consistent event semantics and documentation, explicitly state when events will be emitted and which arguments they receive. (#73 and #69 by @clue)
The documentation now explicitly defines each event and its arguments. Custom events and event arguments are still supported. Most notably, all defined events only receive inherently required event arguments and no longer transmit the instance they are emitted on for consistency and performance reasons.
// old (inconsistent and not supported by all implementations) $stream->on('data', function ($data, $stream) { // process $data }); // new (consistent throughout the whole ecosystem) $stream->on('data', function ($data) use ($stream) { // process $data });This mostly adds documentation (and thus some stricter, consistent definitions) for the existing behavior, it does NOT define any major changes otherwise. Most existing code should be compatible with these changes, unless it relied on some undocumented/unintended semantics.
-
Feature / BC break: Consistent method semantics and documentation (#72 by @clue)
This mostly adds documentation (and thus some stricter, consistent definitions) for the existing behavior, it does NOT define any major changes otherwise. Most existing code should be compatible with these changes, unless it relied on some undocumented/unintended semantics.
-
Feature: Consistent
pipe()semantics for closed and closing streams (#71 from @clue)The source stream will now always be paused via
pause()when the destination stream closes. Also, properly stop piping if the source stream closes and remove all event forwarding. -
Improve test suite by adding PHPUnit to
require-devand improving coverage. (#74 and #75 by @clue, #66 by @nawarian)
-
-
v0.4.625 Jan 2017Release notes
Open source →-
Feature: The
Buffercan now be injected into theStream(or be used standalone) (#62 by @clue) -
Fix: Forward
closeevent only once forCompositeStreamandThroughStream(#60 by @clue) -
Fix: Consistent
closeevent behavior forBuffer(#61 by @clue)
-
-
v0.4.513 Nov 2016Release notes
Open source →-
Feature: Support setting read buffer size to
null(infinite) (#42 by @clue) -
Fix: Do not emit
full-drainevent ifBufferis closed duringdrainevent (#55 by @clue) -
Vastly improved performance by factor of 10x to 20x. Raise default buffer sizes to 64 KiB and simplify and improve error handling and unneeded function calls. (#53, #55, #56 by @clue)
-
-
v0.4.422 Aug 2016Release notes
Open source →-
Bug fix: Emit
errorevent and closeStreamwhen accessing the underlying stream resource fails with a permanent error. (#52 and #40 by @clue, #25 by @lysenkobv) -
Bug fix: Do not emit empty
dataevent if nothing has been read (stream reached EOF) (#39 by @clue) -
Bug fix: Ignore empty writes to
Buffer(#51 by @clue) -
Add benchmarking script to measure throughput in CI (#41 by @clue)
-
-
v0.4.307 Oct 2015Release notes
Open source →- Bug fix: Read buffer to 0 fixes error with libevent and large quantity of I/O (@mbonneau)
- Bug fix: No double-write during drain call (@arnaud-lb)
- Bug fix: Support HHVM (@clue)
- Adjust compatibility to 5.3 (@clue)
-
v0.4.210 Sep 2014Release notes
Open source →- Added DuplexStreamInterface
- Stream sets stream resources to non-blocking
- Fixed potential race condition in pipe
-
v0.4.130 Mar 2014 -
v0.4.002 Feb 2014Release notes
Open source →- BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
- BC break: Update to Evenement 2.0
- Dependency: Autoloading and filesystem structure now PSR-4 instead of PSR-0
-
v0.3.416 Feb 2014Release notes
Open source →- Bug fix: [Stream] Fixed 100% CPU spike from non-empty write buffer on closed stream
-
v0.3.309 Jul 2013 -
v0.3.210 May 2013 -
v0.3.121 Apr 2013Release notes
Open source →- Bug fix: [Stream] Allow any
ReadableStreamInterfaceonBufferedSink::createPromise()
- Bug fix: [Stream] Allow any
-
v0.3.014 Apr 2013 -
v0.2.614 Dec 2012 -
v0.2.519 Nov 2012Release notes
Open source →- Feature: Make BufferedSink trigger progress events on the promise (@jsor)
-
v0.2.418 Nov 2012Release notes
Open source →- Feature: Added ThroughStream, CompositeStream, ReadableStream and WritableStream
- Feature: Added BufferedSink
-
v0.2.305 Nov 2012 -
v0.2.228 Oct 2012 -
v0.2.113 Oct 2012 -
v0.2.010 Sep 2012 -
v0.1.112 Jul 2012 -
v0.1.011 Jul 2012