StreamFactoryInterface
Interface
extends
StreamFactoryInterface
Interface StreamFactoryInterface.
Description
Extends the PSR-17 StreamFactoryInterface with additional functionality for creating streams from payloads. Implementations of this interface MUST be capable of generating standard PSR-7 streams as well as payload-aware streams.
Methods
createStreamFromPayload()
: PayloadStreamInterface
Creates a new stream containing the JSON-encoded representation of the provided payload.
Methods
Creates a new stream containing the JSON-encoded representation of the provided payload.
public
createStreamFromPayload(
array<string|int, mixed>
$payload) : PayloadStreamInterface
Description
The returned stream MUST implement PayloadStreamInterface and MUST be readable and seekable. The payload MUST be JSON-encodable and MUST NOT contain resource types.
Parameters
$payload
:
array<string|int, mixed>
Description
the payload to encode and wrap in the stream
Return values
PayloadStreamInterface
Description
the generated stream containing the payload