Quittio 0.3 API

QuittioManager
in package
uses Macroable

Root of the Quittio facade: builds the core from the Laravel configuration, adds events, Blade templates, storage and extension points.

Table of Contents

Constants

EXTENSION_TYPES  : array<string|int, mixed> = \Quittio\Laravel\Support\DriverRegistry::TYPES

Properties

$app  : Container

Methods

__construct()  : mixed
accountStatement()  : RenderableDocumentBuilder
A new account statement with the seller and its defaults.
cancellation()  : InvoiceBuilder
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()  : ValidationResult
Validates like a render run, without template and PDF, and returns the result; see Quittio\Core\Quittio::check().
core()  : Quittio
The core built from the current configuration; it is kept until the quittio configuration changes (config()->set(), another tenant), flush(), extend() or registerCountry().
coreWithLevels()  : Quittio
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.
countries()  : CountryRegistry
The country packs of the core.
defaultVat()  : TaxPreset|null
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()  : RenderableDocumentBuilder
A new delivery note with the seller and its defaults.
document()  : PendingDocument
Starts the render call of a document; a builder is built at once.
edit()  : RenderableInvoiceBuilder
Builder that continues existing invoice data (a draft, an invoice read from XML); the declared amounts are compared with the configured calculator (calculation.*).
extend()  : static
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()  : static
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()  : FormatRegistry
The output formats of the core.
invoice()  : RenderableInvoiceBuilder
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()  : PendingInvoice
Starts a render call: format(), profile(), locale() … and render() or queue(). A builder is built and a model converted (ProvidesInvoiceData) at once.
orderConfirmation()  : RenderableDocumentBuilder
A new order confirmation with the seller and its defaults.
paymentReminder()  : RenderableDocumentBuilder
prepare()  : PreparedInvoice
Calculates and validates without rendering, whatever the validation mode; see Quittio\Core\Quittio::prepare().
profiles()  : ProfileRegistry
The profiles of the core, those of the country packs included.
proforma()  : RenderableDocumentBuilder
A new proforma invoice with the seller and its defaults.
queueDocument()  : RenderDocument
Dispatches a queued render job of a document; PendingDocument::queue()->save() calls it, the fake records the job as well.
queueInvoice()  : RenderInvoice
Dispatches a queued render job; PendingInvoice::queue()->save() calls it, the fake records the job as well.
quote()  : RenderableDocumentBuilder
A new quote with the seller and its defaults (config/quittio.php or the current issuer).
read()  : ReadResult
Reads an incoming XML or PDF e-invoice from its content (bytes), never from a path.
readFile()  : ReadResult
Reads an incoming XML or PDF e-invoice from a file.
registerCountry()  : static
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()  : RenderedDocument
The render run behind PendingDocument::render(), with the events DocumentRendering and DocumentRendered.
renderInvoice()  : RenderedInvoice
The render run behind PendingInvoice::render(), with the events InvoiceRendering, InvoiceValidated (not in the mode "off") or InvoiceValidationFailed, and InvoiceRendered.
settings()  : Settings
Typed read access to config('quittio').
validateFile()  : ValidationResult
Reads and validates an incoming e-invoice (content, never a path) with all configured levels.
validatePath()  : ValidationResult
Reads and validates an incoming e-invoice from a file with all configured levels.
build()  : Quittio
container()  : 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.
run()  : RenderedInvoice
The render run behind renderInvoice(), without the events; the fake replaces it.
runDocument()  : RenderedDocument
The render run behind renderDocument(), without the events; the fake replaces it.

Constants

EXTENSION_TYPES

public array<string|int, mixed> EXTENSION_TYPES = \Quittio\Laravel\Support\DriverRegistry::TYPES

Properties

Methods

__construct()

public __construct(Container $app) : mixed
Parameters
$app : Container

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

public cancellation(InvoiceData $original, string $number[, string|null $reason = null ][, string|null $strategy = null ][, Date|null $issueDate = null ][, array<int, BigDecimal|int|string, amount?: string}>|null $lines = null ][, CancellationHistory|null $history = null ][, string|null $title = null ]) : InvoiceBuilder
Parameters
$original : InvoiceData
$number : string
$reason : string|null = null
$strategy : string|null = null
$issueDate : Date|null = null
$lines : array<int, BigDecimal|int|string, 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

Return values
InvoiceBuilder

core()

The core built from the current configuration; it is kept until the quittio configuration changes (config()->set(), another tenant), flush(), extend() or registerCountry().

public core() : Quittio
Return values
Quittio

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.

public coreWithLevels(array<int, string> $levels) : Quittio
Parameters
$levels : array<int, string>

names as in quittio.validation.levels, e.g. kosit, verapdf

Return values
Quittio

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.

public defaultVat(string|null $sellerCountry, bool $smallBusiness) : TaxPreset|null
Parameters
$sellerCountry : string|null
$smallBusiness : bool
Return values
TaxPreset|null

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.

public extend(string $type, string $name, callable(Container, array<string, mixed>): object $factory) : static
Parameters
$type : string
$name : string
$factory : callable(Container, array<string, mixed>): object
Return values
static

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.

public flush() : static
Return values
static

read()

Reads an incoming XML or PDF e-invoice from its content (bytes), never from a path.

public read(string $content) : ReadResult
Parameters
$content : string
Tags
throws
UnsafeXmlException

when the XML is too large, not well-formed or not allowed

PdfException

when the PDF is too large, encrypted, malformed or exceeds a limit

UnreadableInvoiceException

for an unknown format, ZUGFeRD 1.0 or a PDF without an embedded invoice

Return values
ReadResult

readFile()

Reads an incoming XML or PDF e-invoice from a file.

public readFile(string $path) : ReadResult
Parameters
$path : string
Tags
throws
UnsafeXmlException

when the XML is too large, not well-formed or not allowed

PdfException

when the PDF is too large, encrypted, malformed or exceeds a limit

UnreadableInvoiceException

for an unknown format, ZUGFeRD 1.0 or a PDF without an embedded invoice (or a file that cannot be read)

Return values
ReadResult

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).

public registerCountry(CountryPack $pack) : static
Parameters
$pack : CountryPack
Return values
static

renderInvoice()

The render run behind PendingInvoice::render(), with the events InvoiceRendering, InvoiceValidated (not in the mode "off") or InvoiceValidationFailed, and InvoiceRendered.

public renderInvoice(InvoiceData $invoice, RenderOptions $options) : RenderedInvoice
Parameters
$invoice : InvoiceData
$options : RenderOptions
Tags
throws
ValidationException

when validation finds errors in the mode "error"

ConfigurationException

for an unknown format or an unsupported profile; see Quittio\Core\Quittio::render() for the other exceptions of a run

Return values
RenderedInvoice

validateFile()

Reads and validates an incoming e-invoice (content, never a path) with all configured levels.

public validateFile(string $content) : ValidationResult
Parameters
$content : string
Tags
throws
UnsafeXmlException

when the XML is too large, not well-formed or not allowed

PdfException

when the PDF is too large, encrypted, malformed or exceeds a limit

UnreadableInvoiceException

for an unknown format, ZUGFeRD 1.0 or a PDF without an embedded invoice

Return values
ValidationResult

validatePath()

Reads and validates an incoming e-invoice from a file with all configured levels.

public validatePath(string $path) : ValidationResult
Parameters
$path : string
Tags
throws
UnsafeXmlException

when the XML is too large, not well-formed or not allowed

PdfException

when the PDF is too large, encrypted, malformed or exceeds a limit

UnreadableInvoiceException

for an unknown format, ZUGFeRD 1.0 or a PDF without an embedded invoice (or a file that cannot be read)

Return values
ValidationResult

build()

protected build([array<int, string>|null $levels = null ]) : Quittio
Parameters
$levels : array<int, string>|null = null

validation levels instead of quittio.validation.levels

Return values
Quittio

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.

protected container() : Container
Return values
Container
On this page

Search results