Zum Inhalt springen

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#

MethodDescription
->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(): string

abstract

The main output that download(), stream(), the mail attachment and save() deliver.

Returns
string

download()#

public function download(?string $filename = null): Response

HTTP response that downloads the main output (Content-Disposition attachment) as $filename, by default filename(). The response is not cached.

ParameterTypeDescription
$filename?string = null
Returns
Symfony\Component\HttpFoundation\Response

filename()#

abstract public function filename(?string $extension = null): string

abstract

File name of the main output; $extension replaces its extension.

ParameterTypeDescription
$extension?string = null
Returns
string

mimeType()#

abstract public function mimeType(): string

abstract

MIME type of the main output (contents()).

Returns
string

save()#

public function save(?string $disk = null, ?string $path = null): string

Stores the main output on a filesystem disk (default: quittio.storage.disk).

ParameterTypeDescription
$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): Response

HTTP response that shows the main output in the browser (Content-Disposition inline) as $filename, by default filename(). The response is not cached.

ParameterTypeDescription
$filename?string = null
Returns
Symfony\Component\HttpFoundation\Response

toMailAttachment()#

public function toMailAttachment(): Attachment

The main output as mail attachment, with filename() and mimeType().

Returns
Illuminate\Mail\Attachment

toResponse()#

public function toResponse(Request $request): Response
ParameterTypeDescription
$requestIlluminate\Http\Request
Returns
Symfony\Component\HttpFoundation\Response

Die Open-Core-Pakete stehen unter der MIT-Lizenz. Die rechtlichen Formulierungen der Länderpakete sind mit einer Steuerberatung abzustimmen.