Zum Inhalt springen

API reference

Quittio\Laravel

quittio/laravel#

Quittio\Laravel

  • QuittioManagerRoot of the Quittio facade: builds the core from the Laravel configuration, adds events, Blade templates, storage and extension points.
  • QuittioServiceProviderRegisters the Quittio manager, configuration, views, translations, commands and the local preview route.
  • SellerSeller from config/quittio.php (when the Managed layer is not in use).

Quittio\Laravel\Builder

  • ConfigInvoiceDefaultsThe seller, its first bank account and the small business flag of config/quittio.php.
  • RenderableDocumentBuilderThe document builder of Quittio::quote(), deliveryNote(), paymentReminder() …: renders itself at the end of the chain.
  • RenderableInvoiceBuilderThe invoice builder of Quittio::invoice(): renders (or checks) itself at the end of the chain.

Quittio\Laravel\Contracts

  • InvoiceDefaults interfaceSets the seller and its defaults (bank account, small business flag …) on the builders of Quittio::invoice() and of the document methods (Quittio::quote() …). The default binding takes them from config/quittio.php (ConfigInvoiceDefaults, Seller::apply()); quittio/managed binds the current issuer.
  • ManagedInstaller interfaceImplemented by quittio/managed: runs "quittio:install --managed" (migrations, first issuer).
  • ManagedInvoiceRenderer interfaceImplemented by quittio/managed: renders a stored invoice again ("quittio:render {invoice}").

Quittio\Laravel\Events

  • DocumentRenderedDispatched after a document (quote, reminder, …) was rendered.
  • DocumentRenderingDispatched before a quote, order confirmation, delivery note, proforma invoice, payment reminder or account statement is calculated and rendered.
  • InvoiceRenderedDispatched after all requested formats were produced.
  • InvoiceRenderingDispatched before an invoice is calculated, validated and rendered.
  • InvoiceValidatedDispatched after a render run whose validation did not block it, before InvoiceRendered. $result is the validation of the main (first) format: in mode "error" it has no errors (warnings may be present unless validation.block_on_warnings), in mode "warn" it may contain errors, so check $result->isValid(). Not dispatched in mode "off" (nothing was validated) and not when validation blocked the run (see InvoiceValidationFailed).
  • InvoiceValidationFailedDispatched when validation blocked rendering.
  • MandatoryFieldMissingDispatched when a template omitted mandatory values.
  • QueuedDocumentFailedDispatched when a queued RenderDocument job failed for good: after its last attempt, or at once for errors that another attempt cannot fix. $job->data() returns the document.
  • QueuedDocumentStoredDispatched by a queued RenderDocument job after it stored the document. DocumentRendered precedes it.
  • QueuedInvoiceFailedDispatched when a queued RenderInvoice job failed for good: after its last attempt, or at once for errors that another attempt cannot fix (validation, invalid data, configuration). $job->data() returns the invoice.
  • QueuedInvoiceStoredDispatched by a queued RenderInvoice job after it stored the main output, e.g. to link the stored file to an order. InvoiceRendered precedes it.

Quittio\Laravel\Facades

Quittio\Laravel\Jobs

  • RenderDocumentRenders a quote, delivery note, reminder or other document in the queue and stores it on a disk. The document travels as versioned JSON snapshot (DocumentData::toSnapshot(), brought up to date by quittio.snapshots.document_upcasters), the render options as versioned JSON. Errors that another attempt cannot fix fail the job at once; others are retried.
  • RenderInvoiceRenders an invoice in the queue and stores the main output on a disk.

Quittio\Laravel\Rendering

  • DeliversFile traitDownload, inline display, mail attachment and storage for rendered files.
  • PendingDocumentFluent render call for documents: Quittio::document($quote)->locale('de')->render().
  • PendingInvoiceFluent render call: Quittio::make($order)->profile('en16931')->format('zugferd')->locale('de')->render().
  • QueuedDocumentPending queued render of a document; dispatching happens on save().
  • QueuedInvoicePending queued render; dispatching happens on save().
  • RenderedDocumentRendered quote, delivery note, reminder or statement for Laravel.
  • RenderedInvoiceRendered invoice for Laravel: usable as mail attachment and as HTTP response, storable on any filesystem disk.

Quittio\Laravel\Support

  • SettingsTyped read access to a configuration array ("quittio" by default) with dot notation.

Quittio\Laravel\Templates

  • BladeTemplateEngineRenders Blade views with the invoice view model as $invoice. The name "default" maps to the configured template. Template names may come from invoice data, so only these views can be selected: the configured template (quittio.pdf.template), the shipped views under "quittio::templates." (no partials) and the views of quittio.pdf.templates ("invoices.*" or "namespace::*" allows every view below a prefix). Names that are no Blade view fall back to the plain PHP templates, which resolve names inside their template directories only (never file paths).

Quittio\Laravel\Testing

  • EInvoiceAssertionsThe assertions of {@see InteractsWithQuittio} outside a test case class, e.g. in Pest helper functions: (new EInvoiceAssertions)->assertValidEInvoice($pdf, 'xrechnung').
  • InteractsWithQuittio traitAssertions for feature tests.
  • QuittioFakeCalculates invoices and chooses formats and profiles like a real run (requested formats, defaults.format, the automatic choice, profile keys and objects, defaults.profile), but skips validation, XML, template and PDF. Records every render call and every queued render, and dispatches the events of a real run (InvoiceRendering, InvoiceValidated with an empty result unless validation is off, InvoiceRendered).

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