API reference / Quittio \ Laravel \ Rendering
DeliversFile
trait in quittio/laravel
Quittio\Laravel\Rendering\DeliversFile · Source
Download, inline display, mail attachment and storage for rendered files.
Methods#
| Method | Description |
|---|---|
->contents() | The main output that download(), stream(), the mail attachment and save() deliver. |
->download() | HTTP response that downloads the main output (Content-Disposition attachment) as $filename, by default filename(). The response is not cached. |
->filename() | File name of the main output; $extension replaces its extension. |
->mimeType() | MIME type of the main output (contents()). |
->save() | Stores the main output on a filesystem disk (default: quittio.storage.disk). |
->stream() | HTTP response that shows the main output in the browser (Content-Disposition inline) as $filename, by default filename(). The response is not cached. |
->toMailAttachment() | The main output as mail attachment, with filename() and mimeType(). |
->toResponse() |
contents()#
abstract public function contents(): stringThe main output that download(), stream(), the mail attachment and save() deliver.
- Returns
string
download()#
public function download(?string $filename = null): ResponseHTTP response that downloads the main output (Content-Disposition attachment) as $filename, by default filename(). The response is not cached.
| Parameter | Type | Description |
|---|---|---|
$filename | ?string = null |
- Returns
Symfony\Component\HttpFoundation\Response
filename()#
abstract public function filename(?string $extension = null): stringFile name of the main output; $extension replaces its extension.
| Parameter | Type | Description |
|---|---|---|
$extension | ?string = null |
- Returns
string
mimeType()#
abstract public function mimeType(): stringMIME type of the main output (contents()).
- Returns
string
save()#
public function save(?string $disk = null, ?string $path = null): stringStores the main output on a filesystem disk (default: quittio.storage.disk).
| Parameter | Type | Description |
|---|---|---|
$disk | ?string = null | |
$path | ?string = null |
- Returns
string– the stored path- Throws
RuntimeException– when the disk does not store the file
stream()#
public function stream(?string $filename = null): ResponseHTTP response that shows the main output in the browser (Content-Disposition inline) as $filename, by default filename(). The response is not cached.
| Parameter | Type | Description |
|---|---|---|
$filename | ?string = null |
- Returns
Symfony\Component\HttpFoundation\Response
toMailAttachment()#
public function toMailAttachment(): AttachmentThe main output as mail attachment, with filename() and mimeType().
- Returns
Illuminate\Mail\Attachment
toResponse()#
public function toResponse(Request $request): Response| Parameter | Type | Description |
|---|---|---|
$request | Illuminate\Http\Request |
- Returns
Symfony\Component\HttpFoundation\Response