NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist, #291 most downloaded on Packagist
A stream abstraction to make working with non-blocking I/O simple.
Latest stable
v2.1.3
Last release 22 days ago
31 Oct 2026
Ships unpredictably
gaps range from 8 days to 1.6 years
Nearly every release is documented
notes for 37 of 38 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
52 releases · first in 2017
Drag across the ruler to compare, or tap a release to open it.
Fixed invoking onClose callbacks on WritableIterableStream
onClose callbacks on WritableIterableStreamBase64DecodingReadableStreamFull Changelog: v2.1.2...v2.1.3
Your coding agent can read these notes before it upgrades. Set up the MCP server →
onClose callbacks on WritableIterableStreamBase64DecodingReadableStreamFull Changelog: https://github.com/amphp/byte-stream/compare/v2.1.2...v2.1.3
Fixed the exception type thrown if ReadableIterableStream is closed ( Amp\Pipeline\DisposedException was leaked, now an Amp\ByteStream\ClosedException
ReadableIterableStream is closed (Amp\Pipeline\DisposedException was leaked, now an Amp\ByteStream\ClosedException is thrown).Full Changelog: v2.1.1...v2.1.2
Fixed cancellation not being forwarded to split() in splitLines() .
split() in splitLines().Full Changelog: v2.1.0...v2.1.1
Payload now implements Stringable
Payload now implements Stringablesplit by @xtrime-ru in #108Full Changelog: v2.0.2...v2.1.0
Payload now implements Stringablesplit by @xtrime-ru in https://github.com/amphp/byte-stream/pull/108Full Changelog: https://github.com/amphp/byte-stream/compare/v2.0.2...v2.1.0
Fixed throwing an Error when invoking getStdin() , getStdout() , and getStderr() if the corresponding STDIO stream had been previously closed. Instead
Error when invoking getStdin(), getStdout(), and getStderr() if the corresponding STDIO stream had been previously closed. Instead, an already closed stream instance is returned.Fixed ReadableResourceStream calling Suspension::resume() when destroyed, which could throw an exception when suspending from {main} and an uncaught e
ReadableResourceStream calling Suspension::resume() when destroyed, which could throw an exception when suspending from {main} and an uncaught exception was thrown from the event loop.Initial stable release compatible with AMPHP v3 and fibers.
Initial stable release compatible with AMPHP v3 and fibers.
There are a number of renaming and compatibility breaks with 1.x versions:
ResourceStreamInputStream has been renamed to ReadableStream and now extends Amp\Closable. The read() method now supports an optional Cancellation parameter.OutputStream has been renamed to WritableStream and now extends Amp\Closable. WritableStream::end() no longer accepts an optional data chunk as parameter.IteratorStream has been repalced by ReadableIterableStream, which accepts any iterable of strings (particularly useful with Generator or Pipeline).ResourceInputStream has been renamed to ReadableResourceStream. The read() method has an additional, optional $limit parameter to specify the maximum number of bytes to read.ResourceOutputStream has been renamed to WritableResourceStream.InMemoryStream has been renamed to ReadableBuffer.OutputBuffer has been renamed to WritableBuffer.Payload now accepts a string in addition to a ReadableStream and is final now. Payload::buffer() may only be called once.$limit param to Amp\ByteStream\buffer() and Payload::buffer() to set a limit on the maximum bytes that can be buffered.BufferedReader, a helper class for reading from ReadableStream using fixed lengths or delimiters found within the stream (#94)Pipe.StreamChannel implementing the Channel interface from amphp/sync.Compression sub-namespace and renamed to CompressingWritableStream and DecompressingReadableStream.CompressingReadableStream (#99)DecompressingWritableStream (#99)InputStreamChain has been renamed to ReadableStreamChain.$options param of parseLineDelimitedJson to $flags to match the json_decode function.Payload as finalamphp/pipeline@v1.0 (#101)Fixed compatibility with amphp/pipeline@v1.0
Payload as finalamphp/pipeline@v1.0 (#101)Improved performance of continuous reads in ReadableResourceStream
Improved performance of continuous reads in ReadableResourceStream
Add compatibility with Revolt v1.x
Add DecompressingWritableStream
CompressingReadableStream (https://github.com/amphp/byte-stream/pull/99)DecompressingWritableStream (https://github.com/amphp/byte-stream/pull/99)StreamChannel implementation to properly support backpressure, cancellation and avoid keeping the read watcher alive (https://github.com/amphp/byte-stream/pull/100)Reverted ReadableIterableStream transforming exceptions from the given iterable into StreamException, as this change made the class less flexible for
ReadableIterableStream transforming exceptions from the given iterable into StreamException, as this change made the class less flexible for implementing specialized streams throwing domain-specific exceptions.Fixed cancelling a read in ReadableIterableStream causing all subsequent reads to fail
ReadableIterableStream causing all subsequent reads to failReadableIterableStream throws an exception that is not an instance of StreamException, a StreamException is thrown with the prior thrown exception set as the previous exception$options param of parseLineDelimitedJson to $flags to match the json_decode function.Removed Closable interface since it has been moved to amphp/amp
Closable interface since it has been moved to amphp/ampReadableStream and WritableStream now extend Amp\ClosableRenamed ClosableStream to Closable and added an onClose method to register callbacks that are invoked when the stream closes
ClosableStream to Closable and added an onClose method to register callbacks that are invoked when the stream closes (https://github.com/amphp/byte-stream/pull/97)WritableResourceStream (https://github.com/amphp/byte-stream/pull/96)Fixed double close error in WritableBuffer
WritableBufferAdded StreamChannel implementing the Channel interface from amphp/sync.
StreamChannel implementing the Channel interface from amphp/sync.Compatibility with revolt/event-loop v0.2.x
BufferedReader, a helper class for reading from ReadableStream using fixed lengths or delimiters found within the stream (#94)IterableStream to ReadableIterableStreamEmitterStream to WritableIterableStream and removed the constructor Emitter param. Use WritableIterableStream::getIterator() to retrieve the iterable for readingAsyncWriter after the stream has closed (#93)Fixed @throws annotations in WritableStream
@throws annotations in WritableStreamRemoved the optional $bytes parameter from WritableStream::end().
$bytes parameter from WritableStream::end().ReadableResourceStream::read() now performs a read immediately on the stream to avoid leaving data in PHP's internal stream buffers.$length param on ReadableResourceStream::read() to $limit to better reflect its purpose.$limit param to Amp\ByteStream\buffer() and Payload::buffer() to set a limit on the maximum bytes that can be buffered.Initial beta release compatible with amphp v3.
Initial beta release compatible with amphp v3.
There are a number of renaming and compatibility breaks with v1.x.
ClosableStream and ResourceStreamInputStream has been renamed to ReadableStream and now extends ClosableStream. The read() method now supports an optional Cancellation parameter.OutputStream has been renamed to WritableStream and now extends ClosableStream.IteratorStream has been repalced by IterableStream, which accepts any iterable of strings (particularly useful with Generator or Pipeline).ResourceInputStream has been renamed to ReadableResourceStream. The read() method has an additional, optional $length parameter to specify the maximum number of bytes to read.ResourceOutputStream has been renamed to WritableResourceStream.InMemoryStream has been renamed to ReadableBuffer.OutputBuffer has been renamed to WritableBuffer.Payload now accepts a string in addition to a ReadableStream. Payload::buffer() may only be called once.Pipe and EmitterStream classes.Compression sub-namespace and renamed to CompressingWritableStream and DecompressingReadableStream.InputStreamChain has been renamed to ReadableStreamChain.Iterator Stream documentation by @tncrazvan in #80
Full Changelog: v1.8.1...v1.8.2
Full Changelog: https://github.com/amphp/byte-stream/compare/v1.8.1...v1.8.2
Fixed ResourceInputStream::close() if resource is already closed on PHP 8
ResourceInputStream::close() if resource is already closed on PHP 8ResourceOutputStream::close() if resource is already closed on PHP 8Added custom delimiter support to LineReader
LineReader (#77)Add psalm annotations for static analysis
Updated ResourceOutputStream to be compatible with changes made to EAGAIN and EPIPE error handling in PHP 7.4 (#70, #71)
ResourceOutputStream to be compatible with changes made to EAGAIN and EPIPE error handling in PHP 7.4 (#70, #71)Fixed ResourceInputStream not properly nulling the resource on close (#67, #68)
ResourceInputStream not properly nulling the resource on close (#67, #68)Added line delimited JSON parser
LineReader (#64)InputStreamChain (#66)Fixed ResourceOutputStream::write() or ResourceOutputStream::end() when writing to a peer closed stream throwing from the method call instead of faili
ResourceOutputStream::write() or ResourceOutputStream::end() when writing to a peer closed stream throwing from the method call instead of failing the returned promise.Added setChunkSize() to ResourceInputStream and ResourceOutputStream
setChunkSize() to ResourceInputStream and ResourceOutputStream (#50)getInputBufferStream() and getOutputBufferStream() (#61)ResourceOutputStream, allowing usage with systemd (#58)Fixed broken symlink in release tars.
Added functions getStdin(), getStdout(), and getStderr() which each return a single instance of ResourceInputStream or ResourceOutputStream associated
getStdin(), getStdout(), and getStderr() which each return a single instance of ResourceInputStream or ResourceOutputStream associated with the currently active event loop for the standard streams. (#44)ResourceOutputStream. (#41, #42)- Added Amp\ByteStream\buffer()
Amp\ByteStream\buffer()Fixed detecting when some types of streams are closed (particularly process pipes on macOS)
Added Payload as a replacement for Message.
Payload as a replacement for Message.Message.Fixed issue with ResourceInputStream
ResourceInputStream (#38)Fixed issue with immediate reads, which could result in a blocking loop in combination with immediate writes. Such a situation is only likely on pipes
Fixed wrong exception being thrown for writing to closed ResourceOutputStream
ResourceOutputStream (#35)STDIN on Windows. This might also improve performance for other streams.ResourceOutputStream.Polyfill STDOUT and STDERR for SAPIs not being CLI.
STDOUT and STDERR for SAPIs not being CLI. (#34)PendingReadError in IteratorStream if a previous read is still pending.Suppress errors for feof, because pthreads.
feof, because pthreads. (#32)Fixed ResourceInputStream for STDIO pipes.
OutputBuffer.ResourceInputStream for STDIO pipes.Do not release resource on __destruct() in ResourceInputStream. This ensures getResource() still returning a valid resource during cyclic garbage coll
__destruct() in ResourceInputStream. This ensures getResource() still returning a valid resource during cyclic garbage collection. See #29.Amp\ByteStream\pipe().Use stream_get_contents instead of fread for all resource input streams except for UDP streams. This resolves amphp/artax#138.
stream_get_contents instead of fread for all resource input streams except for UDP streams. This resolves amphp/artax#138.Fixed pending Message::read() not failing on error.
Message::read() not failing on error.Fixed race condition for closed streams. If a stream has been closed, but the final chunk not written yet, a ResourceOutputStream didn't throw an exce
ResourceOutputStream didn't throw an exception as expected, but instead resulted in an InvalidWatcherError.Fixed an issue with writes filling the internal buffer exactly. (StreamException thrown if internal buffer is full and a fwrite() call thus returning
Fixed an issue in Message hiding exceptions when streaming.
Message hiding exceptions when streaming.Added ResourceInputStream::reference() and ResourceInputStream::unreference()
ResourceInputStream::reference() and ResourceInputStream::unreference()Suppress errors on close in resource streams.
Fixed an issue in ResourceOutputStream when writing large data chunks and the $chunkSize provided to the constructor was null.
ResourceOutputStream when writing large data chunks and the $chunkSize provided to the constructor was null.ResourceInputStream closes the readable side of the stream with stream_socket_shutdown (or closes the stream with fclose for read-only streams) when the close method is invoked. The GC was relied upon for this behavior before, but was inconsistent.ResourceOutputStream now closes the writable side of the stream with stream_socket_shutdown (or closes the stream with fclose for write-only streams) when the close method is invoked. The GC was relied upon for this behavior before, but was inconsistent.Fixed warning on already closed resources.
Nothing published for this version
One column per quarter.