FileResponse
MMO\edms\server · 1 symbol · generated 5 Oct 2026
FileResponse
FileResponse.php:19A stored file, sent as it is read: a download can be bigger than PHP's memory, which StreamResponse::render reads the whole stream into.
- Namespace
MMO\edms\server- Extends
- StreamResponse
Index
| CHUNK_SIZE | the size of what is read, then sent, at a time | |
| INLINE_TYPES | the types a browser may show rather than save: an html page or an svg shown in the site would be the site's | |
| handle | ||
| hasBody | ||
| length | ||
| offset | ||
| ContentDisposition($name, $inline) static | A Content-Disposition header for a file named $name: an ascii name for old clients, and the real one as RFC 6266 has it (filename*), so a quote or an accent in a name cannot break the header. | |
| FromFile($file, $request, $inline, $name, $headers) static | The response sending $file, as $request asks for it (a part of it, or nothing if it has it already) | |
| getContent() | ||
| Header($request, $name) static | ||
| IsInline($mime) static | ||
| loopChunks() | ||
| ParseRange($range, $size) static | The part of a file of $size bytes a Range header asks for: one range of bytes (several are answered whole) | |
| render($opts) | Send the bytes, a chunk at a time, as they are read: nothing is left to return | |
| __construct($handle, $offset, $length, $code, $reason, $headers) |
Constants2
CHUNK_SIZE
the size of what is read, then sent, at a time
INLINE_TYPES
the types a browser may show rather than save: an html page or an svg shown in the site would be the site's
Properties4
handle
hasBody
- Type
- bool
length
- Type
- int
offset
- Type
- int
Methods9
ContentDisposition($name, $inline)
staticFileResponse.php:114A Content-Disposition header for a file named $name: an ascii name for old clients, and the real one as RFC 6266 has it (filename*), so a quote or an accent in a name cannot break the header.
| $name | string | |
| $inline = false | bool | if true, the browser shows the file rather than saving it |
| returns | string |
FromFile($file, $request, $inline, $name, $headers)
staticFileResponse.php:54The response sending $file, as $request asks for it (a part of it, or nothing if it has it already)
getContent()
FileResponse.php:158Header($request, $name)
staticFileResponse.php:99| $request | RequestInterface | |
| $name | string | |
| returns | string | a header of $request: under its name, or as php's $_SERVER has it -- the way a request of the server keeps them (Range is HTTP_RANGE) |
IsInline($mime)
staticFileResponse.php:104loopChunks()
FileResponse.php:163| returns | Generator | the bytes sent, a chunk at a time |
ParseRange($range, $size)
staticFileResponse.php:128The part of a file of $size bytes a Range header asks for: one range of bytes (several are answered whole)
| $range | string | |
| $size | int | |
| returns | array | false | null | int, 1: int}|false|null [first byte, last byte], null for the whole file, false if the range is outside it |
render($opts)
FileResponse.php:145Send the bytes, a chunk at a time, as they are read: nothing is left to return
__construct($handle, $offset, $length, $code, $reason, $headers)
FileResponse.php:41Inherited members (74)
| Properties | Declared by | Description | |
|---|---|---|---|
headers | aMessage | ||
ikeys | aMessage | ||
Listeners | aMessage | ||
protocol | aMessage | ||
statusCode | aResponse | ||
statusText | aResponse | ||
stopped | aResponse | ||
stream | StreamResponse |
| Methods | Declared by | Description | |
|---|---|---|---|
addHeader($name, $value) | aMessage | Append a value to a header, keeping any value(s) already set (as opposed to setHeader, which replaces). | |
AddListener($handler, $order) | aMessage | Register a listener directly (as opposed to ConnectListeners's attribute-based discovery). | |
ConnectListeners($obj) | aMessage | Scan $obj's methods for #[Listen(EventClass::class)] attributes and register each one as a listener on the matching event class. | |
debugName() | aResponse | ||
DisconnectListeners($obj) | aMessage | Undo a previous ConnectListeners: removes every listener that connect had registered for $obj on this event class. | |
dispatch() | aMessage | Invoke every GetListeners listener with $this. | |
File($filename, $headers, $clientFilename) | StreamResponse | Create a Stream response using a local file | |
getBody() | StreamResponse | Gets the body of the message. | |
getCharset() | aMessage | ||
getContentExtension() | aMessage | ||
getContentType($single) | StreamResponse | Prefers an explicitly-set 'Content-Type' header (tWithHeaders::getContentType); falls back to the stream's own detected type (Stream::getContentType) when no header was set and the stream… | |
getExitCode() | aResponse | ||
getHeader($name) | aMessage | Retrieves a message header value by the given case-insensitive name. | |
getHeaderLine($name) | aMessage | Retrieves a comma-separated string of the values for a single header. | |
getHeaders() | aMessage | Retrieves all message header values. | |
GetListeners() | aMessage | Collect every listener for this class, including those registered on its parent classes (so a subclass event is also caught by listeners of its parent event), sorted by ascending $order (ties keep … | |
getOrigin() | aMessage | Get origin of the request by looking at 'Origin', then 'Referer', then 'Sender' in the request's headers. | |
getParsedBody() | StreamResponse | Get response body decoded. | |
getProtocolVersion() | aMessage | Retrieves the HTTP protocol version as a string. | |
getReasonPhrase() | aResponse | Gets the response reason phrase associated with the status code. | |
getRedirect() | aResponse | ||
getStatusCode() | aResponse | Gets the response status code. | |
getUserAgent() | aMessage | ||
hasHeader($name) | aMessage | Checks if a header exists by the given case-insensitive name. | |
HasListener($handler) | aMessage | ||
isHTML() | aMessage | ||
isIe() | aMessage | ||
isIphone() | aMessage | ||
isJSON() | aMessage | ||
isMac() | aMessage | ||
isMobile() | aMessage | ||
isOk() | aResponse | ||
isPropagationStopped() | aResponse | ||
isWindows() | aMessage | ||
JSON($filename, $clientFilename) | StreamResponse | Create a Stream response for a local JSON file (attachment, must-revalidate caching). | |
lock() | StreamResponse | Close the underlying stream, releasing its resource. | |
logEvent($event) | StreamResponse | ||
output() | StreamResponse | Send the stream as it is read, a chunk at a time: from its start when it can seek, as render reads it. | |
RemoveListener($handler) | aMessage | Remove the last added handler from the listeners. | |
Send($args) | aMessage | Construct a new instance of this class with $args, then dispatch it to every listener. | |
setCacheControl($cache, $pragma) | aMessage | Set the Cache-Control header (and, optionally, the legacy Pragma header alongside it). | |
setContentType($type, $charset) | aMessage | Set the Content-Type header, appending a charset parameter (unless $charset is null/empty). | |
setExpires($time) | aMessage | Set the Expires header from a unix timestamp, formatted as an RFC 7231 HTTP-date. | |
setHeader($name, $value) | aMessage | Set header, replacing any previous value(s) for the same (case-insensitively matched) header name. | |
SetListenerOrder($handler, $order) | aMessage | Change the order of an already-registered listener, whether added directly via AddListener or indirectly via ConnectListeners (which also stores its [$obj, $methodName] callables here). | |
setRedirect($url, $status) | aResponse | Set a redirection call send() to actually redirect | |
setRequireAuth($realm, $type) | aResponse | Set redirection to a login/password inputbox call send() to actually redirect | |
setStatus($code, $reason) | aResponse | ||
stopPropagation() | aResponse | Prevent any remaining listener in the current dispatch chain from being called. | |
unsetHeader($name) | aMessage | Remove a header entirely. | |
withAddedHeader($name, $value) | aMessage | Return an instance with the specified header appended with the given value. | |
withBody($body) | StreamResponse | Return an instance with the specified message body. | |
withCacheControl($cache, $pragma) | aMessage | Set cache control of a clone. | |
withContentType($type, $charset) | aMessage | Set content type of a clone. | |
withExpires($time) | aMessage | Set cache expire date of a clone. | |
withHeader($name, $value) | aMessage | Return an instance with the provided value replacing the specified header. | |
withHeaders($headers, $reset) | aMessage | Return a clone with every header in $headers set (through tWithHeaders::setHeader, so each value replaces any existing one for the same header name). | |
withoutHeader($name) | aMessage | Return an instance without the specified header. | |
withParsedBody($data) | StreamResponse | ||
withProtocolVersion($version) | aMessage | Return an instance with the specified HTTP protocol version. | |
withRedirect($url, $status) | aResponse | Set a redirection of a clone call send() to actually redirect | |
withRequireAuth($realm, $type) | aResponse | Set redirection to a login/password inputbox of a clone call send() to actually redirect | |
withStatus($code, $reasonPhrase) | aResponse | Return an instance with the specified status code and, optionally, reason phrase. | |
Zip($filename, $headers, $clientFilename) | StreamResponse | Create a Stream response for a local file, forced to the 'zip' content type (File for the rest). | |
__clone() | aResponse | A cloned event starts fresh: propagation is never considered stopped on the clone, even if it was on the original instance. | |
__toString() | aResponse |