amphp/byte-stream
Event-driven byte stream abstractions for PHP 8.1+ in the AMPHP ecosystem. Provides ReadableStream/WritableStream interfaces plus implementations like Payload, buffers, resource/iterable streams, stream chaining, base64 encode/decode, and decompression for fiber-friendly I/O.
ReadableIterableStream is closed (Amp\Pipeline\DisposedException was leaked, now an Amp\ByteStream\ClosedException is thrown).Full Changelog: https://github.com/amphp/byte-stream/compare/v2.1.1...v2.1.2
Full Changelog: https://github.com/amphp/byte-stream/compare/v1.8.1...v1.8.2
split() in splitLines().Full Changelog: https://github.com/amphp/byte-stream/compare/v2.1.0...v2.1.1
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
Error when invoking getStdin(), getStdout(), and getStderr() if the corresponding STDIO stream had been previously closed. Instead, an already closed stream instance is returned.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.
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 (https://github.com/amphp/byte-stream/pull/99)DecompressingWritableStream (https://github.com/amphp/byte-stream/pull/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)Improved performance of continuous reads in ReadableResourceStream
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)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.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.Closable interface since it has been moved to amphp/ampReadableStream and WritableStream now extend Amp\ClosableClosableStream 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)WritableBufferStreamChannel implementing the Channel interface from amphp/sync.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)[@throws](https://github.com/throws) annotations in WritableStream$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.
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.ResourceInputStream::close() if resource is already closed on PHP 8ResourceOutputStream::close() if resource is already closed on PHP 8LineReader (#77)ResourceOutputStream to be compatible with changes made to EAGAIN and EPIPE error handling in PHP 7.4 (#70, #71)ResourceInputStream not properly nulling the resource on close (#67, #68)LineReader (#64)InputStreamChain (#66)ResourceOutputStream::write() or ResourceOutputStream::end() when writing to a peer closed stream throwing from the method call instead of failing the returned promise.setChunkSize() to ResourceInputStream and ResourceOutputStream (#50)getInputBufferStream() and getOutputBufferStream() (#61)ResourceOutputStream, allowing usage with systemd (#58)How can I help you explore Laravel packages today?