\Psr\Http\MessageStreamFactoryInterface

Summary

Methods
Constants
createStream()
createStreamFromFile()
createStreamFromResource()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

createStream()

createStream(string  $content = '') : \Psr\Http\Message\StreamInterface

Create a new stream from a string.

The stream SHOULD be created with a temporary resource.

Parameters

string $content

String content with which to populate the stream.

Returns

\Psr\Http\Message\StreamInterface —

createStreamFromFile()

createStreamFromFile(string  $filename, string  $mode = 'r') : \Psr\Http\Message\StreamInterface

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

Filename or stream URI to use as basis of stream.

string $mode

Mode with which to open the underlying filename/stream.

Throws

\RuntimeException

If the file cannot be opened.

\InvalidArgumentException

If the mode is invalid.

Returns

\Psr\Http\Message\StreamInterface —

createStreamFromResource()

createStreamFromResource(resource  $resource) : \Psr\Http\Message\StreamInterface

Create a new stream from an existing resource.

The stream MUST be readable and may be writable.

Parameters

resource $resource

PHP resource to use as basis of stream.

Returns

\Psr\Http\Message\StreamInterface —