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.

Internal

Table of Contents

Interfaces

SelfEmittableStreamInterface
A PSR-7 stream which allows to be emitted on its own.

Properties

$filename  : string
$stream  : LazyOpenStream

Methods

__construct()  : mixed
Constructor setting up the PHP resource
emit()  : mixed
Output the contents of the file to the output buffer
isWritable()  : bool
write()  : int
createStream()  : StreamInterface
Creates the underlying stream lazily when required.

Properties

$filename read-only

protected string $filename

$stream read-only

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
bool

write()

public write(string $string) : int
Parameters
$string : string
Tags
throws
RuntimeException

on failure.

Return values
int

createStream()

Creates the underlying stream lazily when required.

protected createStream() : StreamInterface
Return values
StreamInterface

        
On this page

Search results