API reference / Quittio \ Laravel
QuittioManager
class in quittio/laravel · uses Illuminate\Support\Traits\Macroable
Quittio\Laravel\QuittioManager · Source
Root of the Quittio facade: builds the core from the Laravel configuration, adds events, Blade templates, storage and extension points.
Constants#
| Constant | Value | Description |
|---|---|---|
EXTENSION_TYPES | \Quittio\Laravel\Support\DriverRegistry::TYPES |
Properties#
| Property | Type | Description |
|---|---|---|
$app protected readonly | Illuminate\Contracts\Container\Container |
Methods#
| Method | Description |
|---|---|
->__construct() | |
->accountStatement() | A new account statement with the seller and its defaults. |
->bonusStatement() | A new bonus statement (Bonusabrechnung, section 17 (4) UStG) with the seller and its defaults. |
->build() | |
->cancellation() | Builder for the cancellation of an issued invoice; render it like any invoice: Quittio::make(Quittio::cancellation($original, 'ST-2026-0001', 'Doppelt berechnet'))->render(). |
->check() | Validates like a render run, without template and PDF, and returns the result; see Quittio\Core\Quittio::check(). |
->container() | The application the manager works in. Under Laravel Octane that is the application of the current request (Container::getInstance()), not the one that created the singleton, so that configuration set for the request applies. |
->core() | The core built from the current configuration; it is kept until the quittio configuration changes (config()->set(), another tenant), flush(), extend() or registerCountry(). |
->coreWithLevels() | A new core (not the cached one) that validates with the configured levels plus $levels, every driver with its settings of validation.drivers.* exactly as in a render run; e.g. quittio:validate --kosit --verapdf. |
->correction() | Builder for a corrected invoice (384) that replaces an issued invoice, see \Quittio\Core\Quittio::correction(); render it like any invoice. |
->countries() | The country packs of the core. |
->defaultVat() | VAT of invoice lines without VAT treatment (InvoiceBuilder::useDefaultVat()): the preset of quittio.defaults.vat, otherwise the standard preset of the seller's country pack; invoices of small businesses use the small business preset of the pack. |
->deliveryNote() | A new delivery note with the seller and its defaults. |
->document() | Starts the render call of a document; a builder is built at once. |
->edit() | Builder that continues existing invoice data (a draft, an invoice read from XML); the declared amounts are compared with the configured calculator (calculation.*). |
->extend() | Registers a driver: renderer, validator, serializer or format_resolver, or a rule that replaces the PHP rule with the code $name. The factory receives the container and the driver's configuration. |
->flush() | Forgets the built core. Not needed after configuration changes: core() builds a new one when the quittio configuration differs from the one the core was built from. |
->formats() | The output formats of the core. |
->invoice() | A new invoice with the seller and its defaults (config/quittio.php, or the current issuer of quittio/managed); ends with ->render() or ->build(). |
->make() | Starts a render call: format(), profile(), locale() … and render() or queue(). A builder is built and a model converted (ProvidesInvoiceData) at once. |
->orderConfirmation() | A new order confirmation with the seller and its defaults. |
->paymentReminder() | |
->prepare() | Calculates and validates without rendering, whatever the validation mode; see Quittio\Core\Quittio::prepare(). |
->priceReduction() | Builder for a document on the reduction of the consideration of an issued invoice (e.g. a cash discount taken), see \Quittio\Core\Quittio::priceReduction(); render it like any invoice. |
->profiles() | The profiles of the core, those of the country packs included. |
->proforma() | A new proforma invoice with the seller and its defaults. |
->queueDocument() | Dispatches a queued render job of a document; PendingDocument::queue()->save() calls it, the fake records the job as well. |
->queueInvoice() | Dispatches a queued render job; PendingInvoice::queue()->save() calls it, the fake records the job as well. |
->quote() | A new quote with the seller and its defaults (config/quittio.php or the current issuer). |
->read() | Reads an incoming XML or PDF e-invoice from its content (bytes), never from a path. |
->readFile() | Reads an incoming XML or PDF e-invoice from a file. |
->registerCountry() | Registers a country pack; it wins over discovered and configured packs with the same code. The next call builds the core again (the default country depends on the packs). |
->renderDocument() | The render run behind PendingDocument::render(), with the events DocumentRendering and DocumentRendered. |
->renderInvoice() | The render run behind PendingInvoice::render(), with the events InvoiceRendering, InvoiceValidated (not in the mode "off") or InvoiceValidationFailed, and InvoiceRendered. |
->run() | The render run behind renderInvoice(), without the events; the fake replaces it. |
->runDocument() | The render run behind renderDocument(), without the events; the fake replaces it. |
->settings() | Typed read access to config('quittio'). |
->validateFile() | Reads and validates an incoming e-invoice (content, never a path) with all configured levels. |
->validatePath() | Reads and validates an incoming e-invoice from a file with all configured levels. |
__construct()#
public function __construct(Container $app)| Parameter | Type | Description |
|---|---|---|
$app | Illuminate\Contracts\Container\Container |
accountStatement()#
public function accountStatement(): RenderableDocumentBuilderA new account statement with the seller and its defaults.
- Returns
RenderableDocumentBuilder
bonusStatement()#
public function bonusStatement(): RenderableDocumentBuilderA new bonus statement (Bonusabrechnung, section 17 (4) UStG) with the seller and its defaults.
- Returns
RenderableDocumentBuilder
build()#
protected function build(list<string>|null $levels = null): Quittio| Parameter | Type | Description |
|---|---|---|
$levels | list<string>|null = null | validation levels instead of quittio.validation.levels |
- Returns
Quittio
cancellation()#
public function cancellation(
InvoiceData $original,
string $number,
?string $reason = null,
?string $strategy = null,
?Date $issueDate = null,
list<array{line: string, quantity?: BigDecimal|int|string, amount?: string}>|null $lines = null,
CancellationHistory|null $history = null,
string|null $title = null,
): InvoiceBuilderBuilder for the cancellation of an issued invoice; render it like any invoice: Quittio::make(Quittio::cancellation($original, 'ST-2026-0001', 'Doppelt berechnet'))->render().
| Parameter | Type | Description |
|---|---|---|
$original | InvoiceData | |
$number | string | |
$reason | ?string = null | |
$strategy | ?string = null | |
$issueDate | ?Date = null | |
$lines | list<array{line: string, Quittio\Laravel\quantity?: Brick\Math\BigDecimal|int|string, Quittio\Laravel\amount?: string}>|null = null | partial cancellation; null = full |
$history | CancellationHistory|null = null | earlier partial cancellations, for the cumulative rounding of the VAT |
$title | string|null = null | document title in the PDF, e.g. "Stornorechnung"; null = the title of the country pack's correction policy |
- Returns
InvoiceBuilder
check()#
public function check(InvoiceData $invoice, RenderOptions $options): ValidationResultValidates like a render run, without template and PDF, and returns the result; see Quittio\Core\Quittio::check().
| Parameter | Type | Description |
|---|---|---|
$invoice | InvoiceData | |
$options | RenderOptions |
- Returns
ValidationResult- Throws
ConfigurationException– for an unknown format or an unsupported profile
container()#
protected function container(): ContainerThe application the manager works in. Under Laravel Octane that is the application of the current request (Container::getInstance()), not the one that created the singleton, so that configuration set for the request applies.
- Returns
Illuminate\Contracts\Container\Container
core()#
public function core(): QuittioThe core built from the current configuration; it is kept until the quittio configuration changes (config()->set(), another tenant), flush(), extend() or registerCountry().
- Returns
Quittio
coreWithLevels()#
public function coreWithLevels(list<string> $levels): QuittioA new core (not the cached one) that validates with the configured levels plus $levels, every driver with its settings of validation.drivers.* exactly as in a render run; e.g. quittio:validate --kosit --verapdf.
| Parameter | Type | Description |
|---|---|---|
$levels | list<string> | names as in quittio.validation.levels, e.g. kosit, verapdf |
- Returns
Quittio
correction()#
public function correction(
InvoiceData $original,
string $number,
?string $reason = null,
?Date $issueDate = null,
?string $title = null,
): InvoiceBuilderBuilder for a corrected invoice (384) that replaces an issued invoice, see \Quittio\Core\Quittio::correction(); render it like any invoice.
| Parameter | Type | Description |
|---|---|---|
$original | InvoiceData | |
$number | string | |
$reason | ?string = null | |
$issueDate | ?Date = null | |
$title | ?string = null |
- Returns
InvoiceBuilder
countries()#
public function countries(): CountryRegistryThe country packs of the core.
- Returns
CountryRegistry
defaultVat()#
public function defaultVat(?string $sellerCountry, bool $smallBusiness): ?TaxPresetVAT of invoice lines without VAT treatment (InvoiceBuilder::useDefaultVat()): the preset of quittio.defaults.vat, otherwise the standard preset of the seller's country pack; invoices of small businesses use the small business preset of the pack.
| Parameter | Type | Description |
|---|---|---|
$sellerCountry | ?string | |
$smallBusiness | bool |
- Returns
?TaxPreset
deliveryNote()#
public function deliveryNote(): RenderableDocumentBuilderA new delivery note with the seller and its defaults.
- Returns
RenderableDocumentBuilder
document()#
public function document(DocumentData|DocumentBuilder $document): PendingDocumentStarts the render call of a document; a builder is built at once.
| Parameter | Type | Description |
|---|---|---|
$document | DocumentData|DocumentBuilder |
- Returns
PendingDocument- Throws
InvalidInvoiceData– when a builder misses the seller, the buyer or a line's essentials
edit()#
public function edit(InvoiceData $data): RenderableInvoiceBuilderBuilder that continues existing invoice data (a draft, an invoice read from XML); the declared amounts are compared with the configured calculator (calculation.*).
| Parameter | Type | Description |
|---|---|---|
$data | InvoiceData |
- Returns
RenderableInvoiceBuilder
extend()#
public function extend(string $type, string $name, Closure $factory): staticRegisters a driver: renderer, validator, serializer or format_resolver, or a rule that replaces the PHP rule with the code $name. The factory receives the container and the driver's configuration.
| Parameter | Type | Description |
|---|---|---|
$type | string | |
$name | string | |
$factory | Closure |
- Returns
static
flush()#
public function flush(): staticForgets the built core. Not needed after configuration changes: core() builds a new one when the quittio configuration differs from the one the core was built from.
- Returns
static
formats()#
public function formats(): FormatRegistryThe output formats of the core.
- Returns
FormatRegistry
invoice()#
public function invoice(): RenderableInvoiceBuilderA new invoice with the seller and its defaults (config/quittio.php, or the current issuer of quittio/managed); ends with ->render() or ->build().
- Returns
RenderableInvoiceBuilder
make()#
public function make(InvoiceData|ProvidesInvoiceData|InvoiceBuilder $data): PendingInvoiceStarts a render call: format(), profile(), locale() … and render() or queue(). A builder is built and a model converted (ProvidesInvoiceData) at once.
| Parameter | Type | Description |
|---|---|---|
$data | InvoiceData|ProvidesInvoiceData|InvoiceBuilder |
- Returns
PendingInvoice- Throws
InvalidInvoiceData– when a builder misses an essential part (see InvoiceBuilder::build())
orderConfirmation()#
public function orderConfirmation(): RenderableDocumentBuilderA new order confirmation with the seller and its defaults.
- Returns
RenderableDocumentBuilder
paymentReminder()#
public function paymentReminder(int $level = 0): RenderableDocumentBuilder| Parameter | Type | Description |
|---|---|---|
$level | int = 0 | 0 = payment reminder, 1 = first reminder, 2 = second reminder … |
- Returns
RenderableDocumentBuilder
prepare()#
public function prepare(InvoiceData $invoice, RenderOptions $options): PreparedInvoiceCalculates and validates without rendering, whatever the validation mode; see Quittio\Core\Quittio::prepare().
| Parameter | Type | Description |
|---|---|---|
$invoice | InvoiceData | |
$options | RenderOptions |
- Returns
PreparedInvoice- Throws
ConfigurationException– for an unknown format or an unsupported profile
priceReduction()#
public function priceReduction(
InvoiceData $original,
string $number,
PriceReductionReason $reason,
BigDecimal|int|string|null $percent = null,
BigDecimal|int|string|null $amount = null,
array<string, BigDecimal|int|string>|null $amounts = null,
?Date $issueDate = null,
?string $title = null,
): InvoiceBuilderBuilder for a document on the reduction of the consideration of an issued invoice (e.g. a cash discount taken), see \Quittio\Core\Quittio::priceReduction(); render it like any invoice.
| Parameter | Type | Description |
|---|---|---|
$original | InvoiceData | |
$number | string | |
$reason | PriceReductionReason | |
$percent | Brick\Math\BigDecimal|int|string|null = null | |
$amount | Brick\Math\BigDecimal|int|string|null = null | |
$amounts | array<string, Brick\Math\BigDecimal|int|string>|null = null | net amount per VAT group ("S:19" => '50.00') |
$issueDate | ?Date = null | |
$title | ?string = null |
- Returns
InvoiceBuilder
profiles()#
public function profiles(): ProfileRegistryThe profiles of the core, those of the country packs included.
- Returns
ProfileRegistry
proforma()#
public function proforma(): RenderableDocumentBuilderA new proforma invoice with the seller and its defaults.
- Returns
RenderableDocumentBuilder
queueDocument()#
public function queueDocument(RenderDocument $job): RenderDocumentDispatches a queued render job of a document; PendingDocument::queue()->save() calls it, the fake records the job as well.
| Parameter | Type | Description |
|---|---|---|
$job | RenderDocument |
- Returns
RenderDocument
queueInvoice()#
public function queueInvoice(RenderInvoice $job): RenderInvoiceDispatches a queued render job; PendingInvoice::queue()->save() calls it, the fake records the job as well.
| Parameter | Type | Description |
|---|---|---|
$job | RenderInvoice |
- Returns
RenderInvoice
quote()#
public function quote(): RenderableDocumentBuilderA new quote with the seller and its defaults (config/quittio.php or the current issuer).
- Returns
RenderableDocumentBuilder
read()#
public function read(string $content): ReadResultReads an incoming XML or PDF e-invoice from its content (bytes), never from a path.
| Parameter | Type | Description |
|---|---|---|
$content | string |
- Returns
ReadResult- Throws
UnsafeXmlException– when the XML is too large, not well-formed or not allowed- Throws
PdfException– when the PDF is too large, encrypted, malformed or exceeds a limit- Throws
UnreadableInvoiceException– for an unknown format, ZUGFeRD 1.0 or a PDF without an embedded invoice
readFile()#
public function readFile(string $path): ReadResultReads an incoming XML or PDF e-invoice from a file.
| Parameter | Type | Description |
|---|---|---|
$path | string |
- Returns
ReadResult- Throws
UnsafeXmlException– when the XML is too large, not well-formed or not allowed- Throws
PdfException– when the PDF is too large, encrypted, malformed or exceeds a limit- Throws
UnreadableInvoiceException– for an unknown format, ZUGFeRD 1.0 or a PDF without an embedded invoice (or a file that cannot be read)
registerCountry()#
public function registerCountry(CountryPack $pack): staticRegisters a country pack; it wins over discovered and configured packs with the same code. The next call builds the core again (the default country depends on the packs).
| Parameter | Type | Description |
|---|---|---|
$pack | CountryPack |
- Returns
static
renderDocument()#
public function renderDocument(
DocumentData $document,
RenderOptions $options,
): RenderedDocumentThe render run behind PendingDocument::render(), with the events DocumentRendering and DocumentRendered.
| Parameter | Type | Description |
|---|---|---|
$document | DocumentData | |
$options | RenderOptions |
- Returns
RenderedDocument
renderInvoice()#
public function renderInvoice(
InvoiceData $invoice,
RenderOptions $options,
): RenderedInvoiceThe render run behind PendingInvoice::render(), with the events InvoiceRendering, InvoiceValidated (not in the mode "off") or InvoiceValidationFailed, and InvoiceRendered.
| Parameter | Type | Description |
|---|---|---|
$invoice | InvoiceData | |
$options | RenderOptions |
- Returns
RenderedInvoice- Throws
ValidationException– when validation finds errors in the mode "error"- Throws
ConfigurationException– for an unknown format or an unsupported profile; see Quittio\Core\Quittio::render() for the other exceptions of a run
run()#
protected function run(InvoiceData $invoice, RenderOptions $options): RenderedInvoiceThe render run behind renderInvoice(), without the events; the fake replaces it.
| Parameter | Type | Description |
|---|---|---|
$invoice | InvoiceData | |
$options | RenderOptions |
- Returns
RenderedInvoice
runDocument()#
protected function runDocument(
DocumentData $document,
RenderOptions $options,
): RenderedDocumentThe render run behind renderDocument(), without the events; the fake replaces it.
| Parameter | Type | Description |
|---|---|---|
$document | DocumentData | |
$options | RenderOptions |
- Returns
RenderedDocument
settings()#
public function settings(): SettingsTyped read access to config('quittio').
- Returns
Settings
validateFile()#
public function validateFile(string $content): ValidationResultReads and validates an incoming e-invoice (content, never a path) with all configured levels.
| Parameter | Type | Description |
|---|---|---|
$content | string |
- Returns
ValidationResult- Throws
UnsafeXmlException– when the XML is too large, not well-formed or not allowed- Throws
PdfException– when the PDF is too large, encrypted, malformed or exceeds a limit- Throws
UnreadableInvoiceException– for an unknown format, ZUGFeRD 1.0 or a PDF without an embedded invoice
validatePath()#
public function validatePath(string $path): ValidationResultReads and validates an incoming e-invoice from a file with all configured levels.
| Parameter | Type | Description |
|---|---|---|
$path | string |
- Returns
ValidationResult- Throws
UnsafeXmlException– when the XML is too large, not well-formed or not allowed- Throws
PdfException– when the PDF is too large, encrypted, malformed or exceeds a limit- Throws
UnreadableInvoiceException– for an unknown format, ZUGFeRD 1.0 or a PDF without an embedded invoice (or a file that cannot be read)