StreamFactory
in package
implements
StreamFactoryInterface
PSR-17 stream factory class
Tags
Table of Contents
Interfaces
- StreamFactoryInterface
Methods
- createStream() : StreamInterface
- Create a new stream from a string
- createStreamFromFile() : StreamInterface
- Create a new stream from a file path
- createStreamFromResource() : StreamInterface
- Create a new stream from an existing resource
Methods
createStream()
Create a new stream from a string
public
createStream([string $content = '' ]) : StreamInterface
Parameters
- $content : string = ''
Return values
StreamInterfacecreateStreamFromFile()
Create a new stream from a file path
public
createStreamFromFile(string $filename[, string $mode = 'r' ]) : StreamInterface
Opens the file directly with the given mode (bypassing Body::setContentFromFile(), which always opens read-only) so the stream honors the mode the caller requested, and throws \RuntimeException on failure per the PSR-17 contract.
Parameters
- $filename : string
- $mode : string = 'r'
Tags
Return values
StreamInterfacecreateStreamFromResource()
Create a new stream from an existing resource
public
createStreamFromResource(mixed $resource) : StreamInterface
Parameters
- $resource : mixed