ByteStream
Table of Contents
Namespaces
Interfaces
- ReadableStream
- A `ReadableStream` allows reading byte streams in chunks.
- ResourceStream
- WritableStream
- A `WritableStream` allows writing data in chunks. Writers can wait on the returned promises to feel the backpressure.
Classes
- AsyncWriter
- This class provides a tool for efficiently writing to a stream asynchronously. A single fiber is used for all writes to the stream, while each write returns a {@see Future} instead of waiting for each write to complete before returning control to the caller.
- BufferedReader
- BufferException
- ClosedException
- Payload
- Creates a buffered message from a ReadableStream.
- PendingReadError
- Thrown in case a second read operation is attempted while another read operation is still pending.
- Pipe
- Create a local stream where data written to the pipe is immediately available on the pipe.
- ReadableBuffer
- ReadableStream with a single already known data chunk.
- ReadableIterableStream
- Creates a stream from an iterable emitting strings. If the iterable throws an exception, the exception will be thrown from {@see read()} and {@see buffer()}. Consider wrapping any exceptions in {@see StreamException} if you do not wish for another type of exception to be thrown from the stream.
- ReadableResourceStream
- Readable stream abstraction for PHP's stream resources.
- ReadableStreamChain
- StreamChannel
- An asynchronous channel for sending data between threads and processes.
- StreamException
- WritableBuffer
- WritableIterableStream
- WritableResourceStream
- Output stream abstraction for PHP's stream resources.
Traits
Functions
- pipe() : int
- buffer() : string
- getInputBufferStream() : ReadableResourceStream
- The php://input buffer stream for the process associated with the currently active event loop.
- getOutputBufferStream() : WritableResourceStream
- The php://output buffer stream for the process associated with the currently active event loop.
- getStdin() : ReadableResourceStream
- The STDIN stream for the process associated with the currently active event loop.
- getStdout() : WritableResourceStream
- The STDOUT stream for the process associated with the currently active event loop.
- getStderr() : WritableResourceStream
- The STDERR stream for the process associated with the currently active event loop.
- split() : Traversable<int, string>
- Splits the stream into chunks based on a delimiter.
- splitLines() : Traversable<int, string>
- Splits the stream into lines.
- parseLineDelimitedJson() : Traversable<int, mixed>
Functions
pipe()
pipe(ReadableStream $source, WritableStream $destination[, Cancellation|null $cancellation = null ]) : int
Parameters
- $source : ReadableStream
- $destination : WritableStream
- $cancellation : Cancellation|null = null
Return values
int —The number of bytes written to the destination.
buffer()
buffer(ReadableStream $source[, Cancellation|null $cancellation = null ][, int $limit = PHP_INT_MAX ]) : string
Parameters
- $source : ReadableStream
- $cancellation : Cancellation|null = null
- $limit : int = PHP_INT_MAX
-
Only buffer up to the given number of bytes, throwing BufferException if exceeded.
Tags
Return values
string —Entire contents of the InputStream.
getInputBufferStream()
The php://input buffer stream for the process associated with the currently active event loop.
getInputBufferStream() : ReadableResourceStream
Return values
ReadableResourceStreamgetOutputBufferStream()
The php://output buffer stream for the process associated with the currently active event loop.
getOutputBufferStream() : WritableResourceStream
Return values
WritableResourceStreamgetStdin()
The STDIN stream for the process associated with the currently active event loop.
getStdin() : ReadableResourceStream
Return values
ReadableResourceStreamgetStdout()
The STDOUT stream for the process associated with the currently active event loop.
getStdout() : WritableResourceStream
Return values
WritableResourceStreamgetStderr()
The STDERR stream for the process associated with the currently active event loop.
getStderr() : WritableResourceStream
Return values
WritableResourceStreamsplit()
Splits the stream into chunks based on a delimiter.
split(ReadableStream $source, non-empty-string $delimiter[, Cancellation|null $cancellation = null ]) : Traversable<int, string>
Parameters
- $source : ReadableStream
- $delimiter : non-empty-string
- $cancellation : Cancellation|null = null
Return values
Traversable<int, string>splitLines()
Splits the stream into lines.
splitLines(ReadableStream $source[, Cancellation|null $cancellation = null ]) : Traversable<int, string>
Parameters
- $source : ReadableStream
- $cancellation : Cancellation|null = null
Return values
Traversable<int, string>parseLineDelimitedJson()
parseLineDelimitedJson(ReadableStream $source[, bool $associative = false ][, int<1, 2147483647> $depth = 512 ][, int $flags = 0 ][, Cancellation|null $cancellation = null ]) : Traversable<int, mixed>
Parameters
- $source : ReadableStream
- $associative : bool = false
- $depth : int<1, 2147483647> = 512
- $flags : int = 0
- $cancellation : Cancellation|null = null
Tags
Return values
Traversable<int, mixed> —Traversable of decoded JSON values