API reference / Quittio \ Laravel \ Rendering
RenderedInvoice
final class in quittio/laravel · implements Illuminate\Contracts\Mail\Attachable, Illuminate\Contracts\Support\Responsable · uses DeliversFile
Quittio\Laravel\Rendering\RenderedInvoice · Source
Rendered invoice for Laravel: usable as mail attachment and as HTTP response, storable on any filesystem disk.
Methods#
| Method | Description |
|---|---|
->__construct() | |
->as() | The result for another format of the same run. |
->cancel() | Cancels this invoice: builds the cancellation with Quittio::cancellation() and renders it in the formats of this invoice. $lines cancels part of it, $history passes the earlier partial cancellations (see Quittio::cancellation()). |
->contents() | The main output: PDF, otherwise XML, HTML or JSON. |
->core() | The result of the core, e.g. for save() to a local path. |
->data() | The calculated invoice data of the run (totals, VAT breakdown, due date). |
->download() | |
->filename() | File name of the main output, from the configured pattern; $extension replaces the extension of the main output. |
->format() | Key of the format of this result, e.g. "zugferd". |
->formats() | |
->hashes() | |
->hasPdf() | Whether this format produced a PDF. |
->hasXml() | Whether this format produced XML (also the XML embedded in a PDF). |
->html() | The rendered template, as mPDF received it. |
->json() | The invoice as JSON (InvoiceData::toJson()). |
->mimeType() | MIME type of the main output (contents()). |
->pdf() | The PDF. |
->profile() | Profile of the XML; null for formats without XML. |
->save() | Stores the main output on a filesystem disk (default: quittio.storage.disk). |
->stream() | |
->toMailAttachment() | |
->toResponse() | |
->validation() | Validation result of this format; in the mode "warn" it may contain errors, empty in the mode "off". |
->xml() | The e-invoice XML, also the one embedded in the PDF. |
__construct()#
public function __construct(RenderedInvoice $result)| Parameter | Type | Description |
|---|---|---|
$result | RenderedInvoice |
as()#
public function as(string $format): selfThe result for another format of the same run.
| Parameter | Type | Description |
|---|---|---|
$format | string |
- Returns
self- Throws
LogicException– when the format was not rendered in this run
cancel()#
public function cancel(
string $number,
?string $reason = null,
list<array{line: string, quantity?: BigDecimal|int|string, amount?: string}>|null $lines = null,
Date|DateTimeInterface|string|null $issueDate = null,
?string $strategy = null,
?CancellationHistory $history = null,
): selfCancels this invoice: builds the cancellation with Quittio::cancellation() and renders it in the formats of this invoice. $lines cancels part of it, $history passes the earlier partial cancellations (see Quittio::cancellation()).
| Parameter | Type | Description |
|---|---|---|
$number | string | |
$reason | ?string = null | |
$lines | list<array{line: string, Quittio\Laravel\Rendering\quantity?: Brick\Math\BigDecimal|int|string, Quittio\Laravel\Rendering\amount?: string}>|null = null | |
$issueDate | Date|DateTimeInterface|string|null = null | |
$strategy | ?string = null | |
$history | ?CancellationHistory = null |
- Returns
self
contents()#
public function contents(): stringThe main output: PDF, otherwise XML, HTML or JSON.
- Returns
string
core()#
public function core(): RenderedInvoiceThe result of the core, e.g. for save() to a local path.
- Returns
RenderedInvoice
data()#
public function data(): InvoiceDataThe calculated invoice data of the run (totals, VAT breakdown, due date).
- Returns
InvoiceData
download()#
public function download(?string $filename = null): Response| Parameter | Type | Description |
|---|---|---|
$filename | ?string = null |
- Returns
Symfony\Component\HttpFoundation\Response
filename()#
public function filename(?string $extension = null): stringFile name of the main output, from the configured pattern; $extension replaces the extension of the main output.
| Parameter | Type | Description |
|---|---|---|
$extension | ?string = null |
- Returns
string
format()#
public function format(): stringKey of the format of this result, e.g. "zugferd".
- Returns
string
formats()#
public function formats(): list<string>- Returns
list<string>
hashes()#
public function hashes(): array<string, string>- Returns
array<string, string>
hasPdf()#
public function hasPdf(): boolWhether this format produced a PDF.
- Returns
bool
hasXml()#
public function hasXml(): boolWhether this format produced XML (also the XML embedded in a PDF).
- Returns
bool
html()#
public function html(): stringThe rendered template, as mPDF received it.
- Returns
string- Throws
LogicException– when the format produced no HTML
json()#
public function json(): stringThe invoice as JSON (InvoiceData::toJson()).
- Returns
string
mimeType()#
public function mimeType(): stringMIME type of the main output (contents()).
- Returns
string
pdf()#
public function pdf(): stringThe PDF.
- Returns
string- Throws
LogicException– when the format produces no PDF (see hasPdf())
profile()#
public function profile(): ?ProfileProfile of the XML; null for formats without XML.
- Returns
?Profile
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): Response| Parameter | Type | Description |
|---|---|---|
$filename | ?string = null |
- Returns
Symfony\Component\HttpFoundation\Response
toMailAttachment()#
public function toMailAttachment(): Attachment- Returns
Illuminate\Mail\Attachment
toResponse()#
public function toResponse(Request $request): Response| Parameter | Type | Description |
|---|---|---|
$request | Illuminate\Http\Request |
- Returns
Symfony\Component\HttpFoundation\Response
validation()#
public function validation(): ValidationResultValidation result of this format; in the mode "warn" it may contain errors, empty in the mode "off".
- Returns
ValidationResult
xml()#
public function xml(): stringThe e-invoice XML, also the one embedded in the PDF.
- Returns
string- Throws
LogicException– when the format produces no XML (see hasXml())