moebius/streams

Evented and asynchronous API for streaming data

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/moebius/streams

1.0.0 2022-06-27 23:20 UTC

This package is not auto-updated.

Last update: 2025-10-01 13:21:25 UTC


README

Provides a powerful API for generating PSR-7 compliant streams.

Allows connecting a writable stream to a readable stream. When writing to the writable stream, the readable stream can be read and vice versa.

Moebius\Streams\SourceInterface

Represents a stream of bytes coming from any source.

SourceInterface::write(string $chunk) adds a chunk of bytes to the byte stream. The function will block if any of the readers have requested that the byte stream pause.

SourceInterface::end() signals that the byte stream is complete, and is interpreted as end-of-file when consumed by a ReadableStream.

Moebius\Streams\ReadableStream

Class implements the Psr\Http\Message\StreamInterface and provides read access to the data stream.

Moebius\Stream\WritableStream

Class implements the Psr\Http\Message\StreamInterface and provides write access to the data stream.