As the name says, it is made to be basic and direct.
StreamFactory class
Psr\Http\Message\StreamFactoryInterface
Name | Description |
---|---|
createStream | Function createStream |
Create a new stream from a string. | |
createStreamFromFile | Function createStreamFromFile |
Create a stream from an existing file. | |
createStreamFromResource | Create a new stream from an existing resource. |
Description
public createStream (string $content)
Function createStream Create a new stream from a string.
The stream SHOULD be created with a temporary resource.
Parameters
(string) $content
Return Values
\StreamInterface
Description
public createStreamFromFile (string $filename, string $mode)
Function createStreamFromFile Create a stream from an existing file.
The file MUST be opened using the given mode, which may be any mode
supported by the fopen
function.
The $filename
MAY be any string supported by fopen()
.
Parameters
(string) $filename
(string) $mode
Return Values
\StreamInterface
Throws Exceptions
\RuntimeException
If the file cannot be opened.
\InvalidArgumentException
If the mode is invalid.
Description
public createStreamFromResource (resource $resource)
Create a new stream from an existing resource.
The stream MUST be readable and may be writable.
Parameters
(resource) $resource
Return Values
\StreamInterface