Skip to content

StreamFactory: createStream Example

Terry L edited this page Jun 21, 2020 · 4 revisions

Shieldon\Psr17\StreamFactory

createStream($content)

Create a new stream from a string. The stream will be created with a temporary resource.

  • param string content = "" String content with which to populate the stream.
  • return StreamInterface

Example:

$streamFactory = new StreamFactory();
$stream = $streamFactory->createStream('Foo Bar');

echo $stream;
// Outputs: Foo Bar
Clone this wiki locally