SelfEmittableLazyOpenStream implements SelfEmittableStreamInterface uses StreamDecoratorTrait
This class implements a stream that can be used like a usual PSR-7 stream but is additionally able to provide a file-serving fastpath using readfile().
The file this stream refers to is opened on demand.
Table of Contents
Interfaces
- SelfEmittableStreamInterface
- A PSR-7 stream which allows to be emitted on its own.
Properties
Methods
- __construct() : mixed
- Constructor setting up the PHP resource
- emit() : mixed
- Output the contents of the file to the output buffer
- isWritable() : bool
- write() : mixed
- createStream() : StreamInterface
- Creates the underlying stream lazily when required.
Properties
$filename
protected
string
$filename
$stream
protected
LazyOpenStream
$stream
Methods
__construct()
Constructor setting up the PHP resource
public
__construct(string $filename) : mixed
Parameters
- $filename : string
emit()
Output the contents of the file to the output buffer
public
emit() : mixed
isWritable()
public
isWritable() : bool
Return values
boolwrite()
public
write(string $string) : mixed
Parameters
- $string : string
Tags
createStream()
Creates the underlying stream lazily when required.
protected
createStream() : StreamInterface