Skip to content

StreamFactory: createStreamFromResource Example

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

Shieldon\Psr17\StreamFactory

createStreamFromResource($resource)

Create a new stream from an existing resource.

  • param string resource * The PHP resource to use as the basis for the stream.
  • return StreamInterface

Example:

$streamFactory = new StreamFactory();
$stream = $streamFactory->createStreamResource(
    fopen('php://temp', 'r+')
);