Skip to content

API reference / Quittio \ Laravel \ Rendering

RenderedDocument

final class in quittio/laravel · implements Illuminate\Contracts\Mail\Attachable, Illuminate\Contracts\Support\Responsable · uses DeliversFile

Quittio\Laravel\Rendering\RenderedDocument · Source

Rendered quote, delivery note, reminder or statement for Laravel.

Methods#

MethodDescription
->__construct()
->contents()The main output: the PDF, otherwise the HTML.
->core()The result of the core, e.g. for save() to a local path.
->data()The calculated document data the output was rendered from.
->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 from the configured pattern, with the extension pdf or html; $extension replaces it.
->hasPdf()Whether a PDF was rendered (false after htmlOnly()).
->html()The rendered template HTML, also when a PDF was rendered.
->mimeType()MIME type of the main output (contents()): application/pdf, or text/html without a PDF.
->notices()Plausibility hints on the document, e.g. a reminder that claims reminder fees besides the flat rate (see Quittio\Core\Documents\DocumentData::notices()).
->pdf()The PDF. Throws a LogicException when the document was rendered as HTML only (see hasPdf()).
->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()

__construct()#

public function __construct(RenderedDocument $result)
ParameterTypeDescription
$resultRenderedDocument

contents()#

public function contents(): string

The main output: the PDF, otherwise the HTML.

Returns
string

core()#

public function core(): RenderedDocument

The result of the core, e.g. for save() to a local path.

Returns
RenderedDocument

data()#

public function data(): DocumentData

The calculated document data the output was rendered from.

Returns
DocumentData

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()#

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

File name of the main output from the configured pattern, with the extension pdf or html; $extension replaces it.

ParameterTypeDescription
$extension?string = null
Returns
string

hasPdf()#

public function hasPdf(): bool

Whether a PDF was rendered (false after htmlOnly()).

Returns
bool

html()#

public function html(): string

The rendered template HTML, also when a PDF was rendered.

Returns
string

mimeType()#

public function mimeType(): string

MIME type of the main output (contents()): application/pdf, or text/html without a PDF.

Returns
string

notices()#

public function notices(): list<ValidationMessage>

Plausibility hints on the document, e.g. a reminder that claims reminder fees besides the flat rate (see Quittio\Core\Documents\DocumentData::notices()).

Returns
list<ValidationMessage>

pdf()#

public function pdf(): string

The PDF. Throws a LogicException when the document was rendered as HTML only (see hasPdf()).

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

The open core packages are MIT licensed. The legal wording of the country packs must be confirmed by a tax adviser.