Functions related to the output of file content.
More...
|
| __construct ( $path, array $params=[]) |
|
| stream ( $headers=[], $sendErrors=true, $optHeaders=[], $flags=0) |
| Stream a file to the browser, adding all the headings and fun stuff.
|
|
|
static | parseRange ( $range, $size) |
| Convert a Range header value to an absolute (start, end) range tuple.
|
|
static | preprocessHeaders ( $headers) |
| Takes HTTP headers in a name => value format and converts them to the weird format expected by stream().
|
|
static | send404Message ( $fname, $flags=0) |
| Send out a standard 404 message for a file.
|
|
Functions related to the output of file content.
- Since
- 1.28
Definition at line 31 of file HTTPFileStreamer.php.
◆ __construct()
HTTPFileStreamer::__construct |
( |
| $path, |
|
|
array | $params = [] ) |
- Parameters
-
string | $path | Local filesystem path to a file |
array | $params | Options map, which includes:
- obResetFunc : alternative callback to clear the output buffer
- streamMimeFunc : alternative method to determine the content type from the path
- headerFunc : alternative method for sending response headers
|
Definition at line 74 of file HTTPFileStreamer.php.
References $params, and $path.
◆ contentTypeFromPath()
static HTTPFileStreamer::contentTypeFromPath |
( |
| $filename | ) |
|
|
staticprotected |
Determine the file type of a file based on the path.
- Parameters
-
string | $filename | Storage path or file system path |
- Returns
- null|string
Definition at line 279 of file HTTPFileStreamer.php.
◆ parseRange()
static HTTPFileStreamer::parseRange |
( |
| $range, |
|
|
| $size ) |
|
static |
Convert a Range header value to an absolute (start, end) range tuple.
- Parameters
-
string | $range | Range header value |
int | $size | File size |
- Returns
- array|string Returns error string on failure (start, end, length)
- Since
- 1.24
Definition at line 236 of file HTTPFileStreamer.php.
◆ preprocessHeaders()
static HTTPFileStreamer::preprocessHeaders |
( |
| $headers | ) |
|
|
static |
◆ resetOutputBuffers()
static HTTPFileStreamer::resetOutputBuffers |
( |
| ) |
|
|
staticprotected |
◆ send404Message()
static HTTPFileStreamer::send404Message |
( |
| $fname, |
|
|
| $flags = 0 ) |
|
static |
Send out a standard 404 message for a file.
- Parameters
-
string | $fname | Full name and path of the file to stream |
int | $flags | Bitfield of STREAM_* constants |
- Since
- 1.24
Definition at line 212 of file HTTPFileStreamer.php.
◆ stream()
HTTPFileStreamer::stream |
( |
| $headers = [], |
|
|
| $sendErrors = true, |
|
|
| $optHeaders = [], |
|
|
| $flags = 0 ) |
Stream a file to the browser, adding all the headings and fun stuff.
Headers sent include: Content-type, Content-Length, Last-Modified, and Content-Disposition.
- Parameters
-
array | $headers | Any additional headers to send if the file exists |
bool | $sendErrors | Send error messages if errors occur (like 404) |
array | $optHeaders | HTTP request header map (e.g. "range") (use lowercase keys) |
int | $flags | Bitfield of STREAM_* constants |
- Returns
- bool Success
Definition at line 97 of file HTTPFileStreamer.php.
References $header.
Referenced by MediaTransformOutput\streamFileWithStatus().
◆ $headerFunc
callable HTTPFileStreamer::$headerFunc |
|
protected |
◆ $obResetFunc
callable HTTPFileStreamer::$obResetFunc |
|
protected |
◆ $path
string HTTPFileStreamer::$path |
|
protected |
◆ $streamMimeFunc
callable HTTPFileStreamer::$streamMimeFunc |
|
protected |
◆ STREAM_ALLOW_OB
const HTTPFileStreamer::STREAM_ALLOW_OB = 2 |
◆ STREAM_HEADLESS
const HTTPFileStreamer::STREAM_HEADLESS = 1 |
The documentation for this class was generated from the following file: