StreamFactory implements StreamFactoryInterface
Note that this is not public API, use PSR-17 interfaces instead.
Table of Contents
Interfaces
- StreamFactoryInterface
Methods
- createStream() : StreamInterface
- Create a new stream from a string.
- createStreamFromFile() : StreamInterface
- Create a stream from an existing file.
- 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 = ''
-
String content with which to populate the stream.
Return values
StreamInterfacecreateStreamFromFile()
Create a stream from an existing file.
public
createStreamFromFile(string $filename[, string $mode = 'r' ]) : StreamInterface
The $filename
MAY be any string supported by fopen()
.
Parameters
- $filename : string
-
Filename or stream URI to use as basis of stream.
- $mode : string = 'r'
-
Mode with which to open the underlying filename/stream.
Tags
Return values
StreamInterfacecreateStreamFromResource()
Create a new stream from an existing resource.
public
createStreamFromResource(resource $resource) : StreamInterface
The stream MUST be readable and may be writable.
Parameters
- $resource : resource
-
PHP resource to use as basis of stream.