Skip to content

API reference

Quittio\Core

quittio/core#

Quittio\Core

  • ConfigConfiguration of the core without Laravel. The Laravel package translates config/quittio.php into it (Quittio\Laravel\Support\ConfigMapper), whose layout differs from the keys of fromArray().
  • QuittioEntry point without Laravel:

Quittio\Core\Builder

  • InvoiceBuilderFluent builder for InvoiceData.
  • LineStarts an invoice line for InvoiceBuilder::line() and lines() without a callback: ->line(Line::make('Consulting', netPrice: '120.00')->sellerId('C-1')). Simple lines need no builder: ->line('Consulting', netPrice: '120.00', quantity: 4, unit: UnitCode::Hour).
  • LineBuilderFluent builder for an invoice line (BG-25).
  • PartyStarts a seller or buyer for InvoiceBuilder::seller() and buyer() without a callback: ->buyer(Party::make('Kunde AG')->vatId('DE987654321')->address('Weg 1', '54321', 'Beispielstadt', 'DE')).
  • PartyBuilderFluent builder for the seller (BG-4), the buyer (BG-7) and the payee (BG-10).
  • PaymentTermsBuilderFluent builder for structured payment terms (BT-20, BT-9).

Quittio\Core\Builder\Concerns

  • BuildsAllowancesAndCharges traitDocument level allowances and charges (BG-20, BG-21) and discounts split over the VAT rates.
  • BuildsDelivery traitDelivery information (BG-13) and the invoicing period (BG-14).
  • BuildsExtensions traitData of the EXTENDED profile and of the XRechnung extension.
  • BuildsHeader traitInvoice number, dates, type, currencies, business process and standard version.
  • BuildsLines traitInvoice lines (BG-25) and their groups.
  • BuildsNotesAndAttachments traitInvoice notes (BG-1) and supporting documents (BG-24).
  • BuildsParties traitSeller, buyer, payee and tax representative (BG-4, BG-7, BG-10, BG-11).
  • BuildsPayment traitPayment instructions (BG-16 to BG-19), payment terms and the prepaid and rounding amounts (BT-113, BT-114).
  • BuildsPresentationAndMeta traitPresentation, locale, time zone, custom values, flags and the source of the invoice.
  • BuildsReferences traitDocument references (BT-10 to BT-19, BG-3) and the invoiced object.

Quittio\Core\Calculation

  • AllowanceSplitterSplits a document discount over several VAT groups.
  • CalculationException
  • CalculationPolicyDecisions of the calculator that are not fixed by EN 16931. The policy is configuration of the run and not stored with the invoice: the same data calculated under another policy can give other amounts.
  • DeclaredAmountsDeclared amounts of an existing document (Meta::FLAG_DECLARED_AMOUNTS): whether they are needed at all, and the fingerprint of the amount inputs they belong to.
  • DeclaredAmountsMode enumWhat the calculator does with the declared amounts of an existing document (line net amounts BT-131 and VAT breakdown BT-116, BT-117 that another system rounded differently, see Meta::FLAG_DECLARED_AMOUNTS).
  • En16931CalculatorCalculation according to EN 16931.
  • GrossPriceConverterGross price mode for B2C and shops.
  • LargestRemainderDistributes an amount over weights so that the rounded parts add up exactly (largest remainder method).
  • LineCalculatorCalculates the invoice line net amount (BT-131):
  • TotalsCalculator interfaceCalculates line amounts, allowances and charges, the VAT breakdown and totals.

Quittio\Core\Codes

  • CodeListAccess to the official code lists generated from the EN 16931 rules and, for Peppol, the Peppol BIS rules (resources/codelists/*.json, see tools/codelists/update.php).
  • CodeListGeneratorGenerates the code list files (resources/codelists/*.json) from the official EN 16931 Schematron rules (BR-CL-*), as shipped with the KoSIT validator configuration, and the narrower Peppol lists from the Peppol BIS Schematron.
  • RawCodeA code that is not (yet) part of the code list enums shipped with the package.

Quittio\Core\Contracts

  • ProvidesInvoiceData interfaceImplemented by application models that can be turned into an invoice (e.g. an order).
  • ProvidesInvoiceLine interfaceImplemented by application models that describe an invoice line (e.g. an order item).
  • ProvidesParty interfaceImplemented by application models that describe a trade party (e.g. a customer).

Quittio\Core\Corrections

  • CancellationFull cancellation of an issued invoice: a new invoice with its own number that reverses the original and refers to it (BG-3).
  • CancellationHistoryWhat the earlier partial cancellations of an invoice cancelled per VAT group (category and rate), so that the VAT of the next partial cancellation is rounded cumulatively.
  • CorrectionCorrected invoice (type code 384) that replaces an issued invoice: a copy of the original with its own number, the reference to the original (BG-3) and the note "Diese Rechnung berichtigt und ersetzt die Rechnung … vom …" (BT-22), so that it states by a specific and unambiguous reference that it corrects the original (section 31 (5) UStDV, section 15.2a (7) UStAE). Change what was wrong on the returned builder.
  • PriceReductionDocument on a reduction of the consideration of an issued invoice (section 17 UStG), e.g. a cash discount taken, a reduction because of a complaint about defects or a bonus: a credit note (type code 381, positive amounts) with one line per VAT group of the original, the reference to the original (BG-3) and a note that names the reduction of the net amount and of the VAT per rate (BT-22), titled "Entgeltminderung" in Germany.
  • PriceReductionReason enumWhy the consideration of an invoice was reduced (PriceReduction); the note names it.

Quittio\Core\Countries

  • AbstractCountryPackBase class with neutral defaults, so that country packs only override what differs.
  • CorrectionPolicyDefault handling of cancellations and corrections in a country, and the titles of these documents. Quittio::cancellation() takes the cancellation strategy and the titles "cancellation" and "cancellation_self_billed"; Quittio::correction() the title "correction", Quittio::priceReduction() the title "price_reduction"; the title "self_billed" is the title of self-billed invoices in PDF and HTML (InvoiceTitle::policyTitle()); the Managed layer takes the correction strategy.
  • CountryDefaultsDefaults of a country.
  • CountryGenericNeutral pack for countries without an installed country pack: EN 16931 rules only and international formatting. A warning is issued when an invoice is validated with this pack.
  • CountryPack interfaceEverything that differs between countries.
  • CountryRegistryInstalled country packs.
  • CountryResolver interfaceSelects the country packs for an invoice.
  • DefaultCountryResolverThe seller's country (BT-40) determines the leading pack. The buyer's country (BT-55) adds rules for cross-border invoices. A country without a pack of its own takes the pack of the country whose VAT territory it belongs to (VatTerritory::vatCountry(): Monaco the French, Liechtenstein the Swiss pack). Without an installed pack, a generic pack is used.
  • DunningLawStatutory late payment rules (EU late payment directive plus national law). Amounts and percentage points are decimal strings.
  • Exporter interfaceCountry specific export format (e.g. DATEV for Germany, FEC for France). Country packs only declare which exporters they provide (CountryPack::exporters()); Quittio runs none of them, applications may.
  • LegalTextCatalogLegal and informational texts of a country pack per locale.
  • MandatoryFieldA value that must appear in the PDF (checked by the mandatory field guard).
  • MandatoryFieldListValues that must be output in the PDF for one invoice.
  • NumberingRulesRequirements for invoice numbering in a country. The Managed layer applies the default pattern, the default reset and the allowed resets.
  • ResolvedCountriesLeading pack (seller side) and, for cross-border invoices, the buyer's pack.
  • RetentionRuleRetention period for invoices.
  • VatTerritoryThe EU VAT territory (Art. 5 to 7 of Directive 2006/112/EC) as far as it can be told from a country code and a postcode.

Quittio\Core\Countries\Capabilities

  • CompletesInvoices interfaceA country pack that completes an invoice before it is calculated, validated and rendered, e.g. with a notice the law of the country expects for some buyers. The render pipeline calls it for the leading pack of the invoice; what it adds is part of the rendered data.
  • ProvidesFormats interfaceA country pack that brings output formats, e.g. a national e-invoice format, with their aliases and the serializers of their syntaxes. Quittio::registerCountry() registers them. AbstractCountryPack implements it with empty defaults.
  • ProvidesReferenceRates interfaceA country pack whose late payment law has a reference interest rate, so that Dunning\DefaultInterest::forCountry() calculates default interest for it.

Quittio\Core\Data

  • IdentifierIdentifier with an optional scheme (ISO/IEC 6523 ICD or another code list depending on the field).
  • InvoiceDataRoot of the semantic invoice model (EN 16931, superset of the 2017 and 2026 versions).
  • MetaPackage-internal metadata: locale, time zone, exchange rate, free data for templates and flags for country packs.
  • NoteInvoice note (BG-1).

Quittio\Core\Data\AllowanceCharge

  • DocumentAllowanceDocument level allowance (BG-20). An allowance has exactly one VAT category and rate.
  • DocumentAllowanceChargeCommon structure of document level allowances (BG-20) and charges (BG-21).
  • DocumentChargeDocument level charge (BG-21).
  • LineAllowanceInvoice line allowance (BG-27).
  • LineAllowanceChargeCommon structure of invoice line allowances (BG-27) and charges (BG-28). Line allowances and charges have no VAT category of their own; they inherit the line's category.
  • LineChargeInvoice line charge (BG-28).

Quittio\Core\Data\Attachments

  • AttachmentAdditional supporting document (BG-24).

Quittio\Core\Data\Concerns

  • Immutable traitGeneric copy-on-write helper for readonly DTOs whose properties are all promoted constructor parameters.

Quittio\Core\Data\Delivery

  • DeliveryDelivery information (BG-13).
  • PeriodInvoicing period (BG-14: BT-73, BT-74) or invoice line period (BG-26: BT-134, BT-135). At least one of start or end must be set; the end must not lie before the start.

Quittio\Core\Data\Extensions

  • ExtendedDataDocument level data that exists only in the Factur-X/ZUGFeRD EXTENDED profile. The selection covers the practically relevant elements.
  • ExtendedPartyAdditional trade party of profile EXTENDED (invoicer, invoicee, ultimate customer, ship-from, line ship-to).
  • IncludedProductComponent of a set or bundle (profile EXTENDED).
  • InstallmentOne of several payment terms with its own due date (profile EXTENDED), e.g. instalments.
  • LineExtendedDataLine level data that exists only in the Factur-X/ZUGFeRD EXTENDED profile.
  • ThirdPartyPaymentAmount collected on behalf of a third party (XRechnung extension, group BG-DEX-09). It is added to the amount due (BR-DEX-09).
  • XRechnungExtensionDataData of the XRechnung extension. Sub invoice lines are modelled via InvoiceLine::$subLines.

Quittio\Core\Data\Lines

  • ClassificationItem classification identifier (BT-158) with scheme (BT-158-1) and scheme version (BT-158-2), e.g. eCl@ss, UNSPSC, CPV or customs tariff numbers.
  • InvoiceLineInvoice line (BG-25).
  • ItemItem information (BG-31).
  • ItemAttributeItem attribute (BG-32), e.g. colour, size, vehicle identification number.
  • LineVatLine VAT information (BG-30).
  • PricePrice details (BG-29). Prices may have more than two decimals.

Quittio\Core\Data\Party

  • AddressPostal address (BG-5 seller, BG-8 buyer, BG-12 tax representative, BG-15 deliver to).
  • BuyerPartyBuyer (BG-7).
  • ContactContact (BG-6 seller: BT-41/42/43, BG-9 buyer: BT-56/57/58).
  • ElectronicAddressElectronic address (BT-34 seller, BT-49 buyer) with its EAS scheme. For Peppol, the electronic address is also the participant identifier.
  • PayeePartyPayee (BG-10), only when different from the seller (factoring, collection, group company).
  • SellerPartySeller (BG-4).
  • TaxRepresentativePartySeller tax representative (BG-11).

Quittio\Core\Data\Payment

  • CashDiscountCash discount ("Skonto") granted for payment within $days days.
  • CreditTransferCredit transfer (BG-17).
  • DirectDebitDirect debit (BG-19).
  • PaymentCardPayment card information (BG-18). Only the last 4 to 6 digits of the card number may be stored.
  • PaymentInstructionsPayment instructions (BG-16).
  • PaymentTermsStructured payment terms. Serialised into BT-20 text (and structured elements where the profile allows).
  • PenaltyTermsLate payment terms. Structured only in profile EXTENDED, otherwise rendered as text.

Quittio\Core\Data\Presentation

  • ColorsColours used by the PDF template.
  • LineGroupGroup of invoice lines with an optional subtotal. Presentation only.
  • LinePresentationPDF-only presentation hints for an invoice line. Never written to XML.
  • PresentationData used only for the PDF. Never written to XML.

Quittio\Core\Data\References

  • DocumentReferenceReference to a related document on line level or as additional reference (profile EXTENDED), e.g. delivery note, order, contract or receiving advice.
  • PrecedingInvoiceReferencePreceding invoice reference (BG-3), used for cancellations, corrections and final invoices.
  • ProjectReferenceProject reference (BT-11). CII requires a name in addition to the identifier.

Quittio\Core\Data\Totals

  • TotalsDocument totals (BG-22), calculated by the calculator.
  • VatBreakdownVAT breakdown (BG-23), one entry per combination of VAT category and rate.

Quittio\Core\Documents

  • AccountStatementAccount statement for a customer: open and paid invoices of a period.
  • BonusStatementData of a bonus statement: a reduction of the consideration of all supplies of a period, e.g. an annual bonus, documented in one statement instead of one document per invoice (in Germany section 17 (4) UStG). The reduction per VAT rate is in the lines of the document.
  • DocumentBuilderFluent builder for documents. Parties, lines, notes, discounts and payment data work exactly like in the {@see InvoiceBuilder}.
  • DocumentCalculatorCalculates documents with the invoice calculator. Optional and alternative lines get their line amounts but are excluded from the totals.
  • DocumentDataQuote, order confirmation, delivery note, proforma invoice, payment reminder, account statement or bonus statement. Shares parties, lines and calculation with {@see InvoiceData}, but never produces e-invoice XML. Payment reminders and account statements have no lines: their amount comes from {@see Dunning} and {@see AccountStatement}.
  • DocumentLineOptionsDocument specific line details, keyed by line identifier in {@see DocumentData}.
  • DocumentType enumCommercial documents that share templates and calculation with invoices but carry no e-invoice XML.
  • DunningData of a payment reminder: open items, fees, interest and the new deadline.
  • DunningFeeFee of a payment reminder (e.g. costs of the reminder, flat rate according to national law).
  • DunningFeeKind enumWhat a fee of a payment reminder is.
  • InterestChargeDefault interest on an open amount for a period (simple interest).
  • OpenItemAn invoice in a payment reminder or account statement.
  • PackagePackage of a delivery note.

Quittio\Core\Dunning

  • DefaultInterestDefault interest of a late payment law: the reference rate plus the points of the DunningLaw (business or consumer debtors), split at every change of the reference rate, with the day count basis of the law; a fixed rate of the law for businesses or consumers instead, if it has one. The result goes into DocumentBuilder::interestCharge().
  • ReferenceRates interfaceThe reference interest rate of a country's late payment law, e.g. the German Basiszinssatz (section 247 BGB) or the ECB main refinancing rate. Default interest is the reference rate plus the points of the DunningLaw.

Quittio\Core\Enums

  • AllowanceReasonCode enumAllowance reason code (BT-98, BT-140), UNTDID 5189 subset.
  • ChargeReasonCode enumCharge reason code (BT-105, BT-145), UNTDID 7161 subset. Further codes can be used as RawCode.
  • DocumentReferenceTypeCode enumDocument type code for additional supporting documents (BG-24), UNTDID 1001 subset.
  • ElectronicAddressScheme enumElectronic address scheme (BT-34-1, BT-49-1), CEF EAS code list. Further codes can be used as RawCode.
  • IdentifierScheme enumIdentifier scheme (ISO/IEC 6523 ICD), e.g. for BT-29, BT-46, BT-157. Further codes can be used as RawCode.
  • InvoiceTypeCode enumDocument type code (BT-3), UNTDID 1001 subset allowed by EN 16931.
  • ItemClassificationScheme enumItem classification scheme (BT-158-1), UNTDID 7143 subset. Further codes can be used as RawCode.
  • MimeType enumMIME code of an attached document (BT-125-1). Xml (application/xml) is not part of the EN 16931 code list (BR-CL-24); only the XRechnung extension allows it (BR-DEX-01).
  • NoteSubjectCode enumInvoice note subject code (BT-21), UNTDID 4451 subset. Further codes can be used as RawCode.
  • PaymentMeansCode enumPayment means type code (BT-81), UNTDID 4461. Further codes can be used as RawCode.
  • TaxPointDateCode enumValue added tax point date code (BT-8).
  • UnitCode enumUnit of measure (BT-130, BT-150), UN/ECE Recommendation 20 and 21. Further codes can be used as RawCode.
  • VatCategory enumVAT category code (BT-95, BT-102, BT-118, BT-151), UNTDID 5305 subset.
  • VatExemptionReasonCode enumVAT exemption reason code (BT-121), VATEX code list. Further codes can be used as RawCode.

Quittio\Core\Enums\Concerns

  • HasLabel traitTranslated labels for code list enums, e.g. "Stunde" for HUR.

Quittio\Core\Exceptions

  • ConfigurationExceptionInvalid configuration or an unsupported combination of format and profile.
  • HydrationExceptionArray or JSON input does not match the invoice data model.
  • InvalidArgumentException\InvalidArgumentException thrown by Quittio; catch QuittioException for every error of the library.
  • InvalidInvoiceDataBuilder or data input is structurally incomplete.
  • LogicException\LogicException thrown by Quittio; catch QuittioException for every error of the library.
  • QuittioException interfaceMarker interface for all exceptions thrown by Quittio.
  • RuntimeException\RuntimeException thrown by Quittio; catch QuittioException for every error of the library.

Quittio\Core\Formats

  • DefaultFormatResolverFormat resolution in this order:
  • ExtendedFeaturesDetects data that only the profile EXTENDED can carry (sub lines, EXTENDED-only fields).
  • FormatChoiceResult of the format resolution: output format key and profile key.
  • FormatRegistryKnown output formats. Country and network packages can register national formats.
  • FormatResolver interfaceChooses format and profile when none is given.
  • FormatRule interfaceA rule of a country pack that decides the output format of an invoice.
  • OutputFormatDefinition of an output format.

Quittio\Core\I18n

  • ArrayTranslatorTranslator backed by PHP array files: {path}/{locale}/{group}.php.
  • TranslationsHolds the translator used for code labels and validation messages.
  • Translator interfaceMinimal translator contract so that the core works without Laravel. Keys use the form "group.key" (e.g. "labels.due_date", "rules.BR-CO-25.message").

Quittio\Core\Mapping

  • FieldDefinitionMetadata of one DTO field, read from its mapping attributes.
  • FieldMatrixField metadata of all DTOs, derived from the mapping attributes (single source for profile validation, documentation and coverage reports).
  • FieldReferenceGenerates docs/field-reference.md from the mapping attributes of the data model.

Quittio\Core\Mapping\Attributes

  • BinaryBinary string; arrays and JSON carry it base64 encoded.
  • BtBusiness term or business group identifier from EN 16931 (e.g. BT-1, BG-25).
  • CardinalityCardinality according to EN 16931: 1, 0..1, 0..n or 1..n.
  • CiiLocation of the field in UN/CEFACT CII, relative to the parent element (informative).
  • ComputedThe value is set by the calculator and is not a user input.
  • ExtendedOnlyThe value exists only in the Factur-X/ZUGFeRD EXTENDED profile.
  • InputForMarks a user input that the calculator copies into the given business term.
  • InternalPackage-internal value without an EN 16931 business term (not written to XML).
  • LevelLowest Factur-X/ZUGFeRD profile level in which the field may be used. Fields without this attribute are available from level EN 16931 on.
  • ListOfElement type of an array property, used for hydration and schema generation.
  • MapOfValue type of an array property keyed by strings, e.g. line options keyed by line identifier; the hydrator keeps the keys.
  • PdfOnlyThe value is used for the PDF only and never written to XML.
  • RequiredInProfile keys in which an optional EN 16931 field becomes mandatory (e.g. "xrechnung").
  • SinceThe field exists from the given version of EN 16931 on.
  • TaxCurrencyMonetary value expressed in the VAT accounting currency (BT-6) instead of the invoice currency.
  • UblLocation of the field in UBL 2.1, relative to the parent element (informative).
  • UntilThe field exists up to and including the given version of EN 16931.
  • XRechnungExtensionOnlyThe value exists only in the XRechnung extension.

Quittio\Core\Pdf

  • EmbeddedXmlInvoice XML to be embedded into a PDF/A-3 (ZUGFeRD/Factur-X, XRechnung in PDF).
  • LogoCachePrepares logos for the PDF and caches the result.
  • PdfEmbeddedFileExtractorExtracts the embedded invoice XML from PDF files (ZUGFeRD 2.x, Factur-X, XRechnung in PDF).
  • PdfException
  • PdfRenderer interfaceTurns HTML (from the template) into a PDF, embedding the invoice XML if requested.
  • RemoteImageFetcherDownloads remote logos without server-side request forgery: only http and https, only hosts whose every resolved address (IPv4 and IPv6) is publicly routable, the connection pinned to the checked address (no second DNS lookup) and every redirect checked again.
  • RenderRequestInput for a PDF renderer.

Quittio\Core\Pdf\PostProcessing

  • MpdfPostProcessorImports the pages of an existing PDF (FPDI via mPDF), embeds the XML and writes PDF/A-3 metadata and output intent.
  • PdfPostProcessor interfaceTurns an existing PDF into PDF/A-3 with embedded invoice XML (for callback and passthrough renderers).

Quittio\Core\Pdf\Qr

  • EpcGiroCodeGeneratorEPC QR code ("GiroCode") for SEPA credit transfers, guideline EPC069-12 version 002.
  • PaymentQrGenerator interfaceCreates the payload of a payment QR code (GiroCode, Swiss QR bill, …).
  • PaymentSlipThe texts of a payment slip with receipt (ProvidesPaymentSlip), laid out by the templates after the Swiss QR bill: receipt (62 mm) and payment part (148 mm) in a strip of 210 × 105 mm at the bottom of the page, with the code at 46 × 46 mm.
  • ProvidesPaymentSlip interfaceA payment QR code generator whose code belongs on a payment slip of its own, e.g. the payment part and receipt of the Swiss QR bill. The default templates then print the slip at the bottom of a page of its own instead of the small code next to the bank details.
  • QrImageRenders QR codes as SVG data URIs for templates (no further dependency besides mpdf/qrcode).

Quittio\Core\Pdf\Renderers

  • CallbackRendererOwn rendering function (e.g. Browsershot, Gotenberg) that returns PDF binary data. PDF/A and the embedded XML are added by the post processor.
  • DenyingHttpClientmPDF HTTP client that refuses every request (defence in depth).
  • MpdfRendererDefault renderer: HTML/CSS to PDF/A-3b with mPDF, in pure PHP.
  • PassthroughRendererUses a finished PDF supplied by the application; only PDF/A and the XML are added.

Quittio\Core\Pdf\Xmp

  • FacturXXmpXMP metadata for Factur-X/ZUGFeRD: the fx description and the PDF/A extension schema. Without the extension schema the PDF is readable, but not valid PDF/A.

Quittio\Core\Profiles

  • AbstractProfileDefaults shared by all profiles. Profiles override what differs.
  • BasicFactur-X/ZUGFeRD BASIC: a subset of EN 16931 with lines.
  • BasicWlFactur-X/ZUGFeRD BASIC WL (without lines). Not an e-invoice in the sense of EN 16931.
  • En16931EN 16931 core invoice (Factur-X/ZUGFeRD profile EN 16931, also as plain CII or UBL).
  • ExtendedFactur-X/ZUGFeRD EXTENDED: EN 16931 plus additional elements.
  • MinimumFactur-X/ZUGFeRD MINIMUM. Not an e-invoice in the sense of EN 16931; booking aid only.
  • PeppolBis3Peppol BIS Billing 3.0, a UBL based CIUS of EN 16931.
  • Profile interfaceAn e-invoice profile (CIUS or extension): which fields are allowed or mandatory, which identifier goes into BT-24 and which additional rules apply.
  • ProfileLevel enumOrdered Factur-X/ZUGFeRD profile levels. Each level contains all fields of the lower levels.
  • ProfileRegistryKnown profiles by key. Country packs and network packages register further profiles.
  • Syntax enumXML syntax of an e-invoice.

Quittio\Core\Profiles\Capabilities

  • DescribesEmbeddedXml interfaceFor profiles whose XML is embedded in a PDF/A-3 with other XMP metadata than Factur-X ("Factur-X/ZUGFeRD Invoice", fx:Version "1.0"), e.g. XRechnung in ZUGFeRD.
  • ExtendsCodeLists interfaceProfiles that accept additional codes on top of the EN 16931 code lists, e.g. the identifier schemes XR01 to XR03 of the XRechnung extension.
  • ReplacesRules interfaceProfiles that replace built-in rules with own rules under other codes, as the official validator configuration does, e.g. the XRechnung extension: BR-CO-16 by BR-DEX-09. The PHP rules driver does not run the replaced rules for this profile, so a violation is reported once.
  • RequiresVatBreakdownRate interfaceMarker for profiles that require the VAT category rate (BT-119) in every VAT breakdown, including category "O" (written as 0). Example: XRechnung (BR-DE-14).
  • StructuredCashDiscountText interfaceMarker for profiles that expect cash discounts as structured lines in BT-20, e.g. XRechnung: "#SKONTO#TAGE=14#PROZENT=2.00#".
  • SupportsExtensionFields interfaceProfiles that transmit the fields of extensions of EN 16931, e.g. "xrechnung" for the fields marked with Mapping\Attributes\XRechnungExtensionOnly.
  • SupportsSubLines interfaceProfiles that transmit sub lines (BG-DEX-01 of the XRechnung extension, the line hierarchy of EXTENDED). Invoices with sub lines are not upgraded to EXTENDED when they use such a profile.
  • SupportsThirdPartyPayments interfaceProfiles whose UBL invoices transmit third party payments (BG-DEX-09 of the XRechnung extension) without contradicting BR-CO-16.

Quittio\Core\Reading

  • DeclaredExemptionReasonsEN 16931 carries the VAT exemption reason (BT-120, BT-121) only on the VAT breakdown, the data model takes it from the lines (LineVat) and document allowances and charges. Readers copy the declared reasons back, so that a recalculation keeps them.
  • DiagnosingXmlExtractor interfaceAn extractor that also reports where the XML came from and what it noticed on the way.
  • EmbeddedXmlExtractor interfaceExtracts the embedded invoice XML from a hybrid PDF (ZUGFeRD/Factur-X, XRechnung in PDF).
  • ExtractedXmlThe invoice XML found in a hybrid PDF, with the file specification it came from.
  • FormatReader interfaceReads one XML invoice format into the data model.
  • InvoiceReaderReads e-invoices from XML or PDF.
  • ReadResultResult of reading an e-invoice: the parsed data, the totals declared in the document (kept unchanged for comparison), findings and the raw input.
  • UnreadableInvoiceExceptionThe input is not a supported e-invoice.

Quittio\Core\Rendering

  • PendingDocumentFluent render call for documents: Quittio::document($quote)->locale('de')->render().
  • PendingInvoiceFluent render call: Quittio::make($data)->profile()->format()->locale()->render().
  • PreparedInvoiceCalculated and validated invoice data plus the decisions a render run would take (format, profile, country pack, locale), without rendering anything. The XML of every format (also the one "pdf" embeds with b2cEmbedXml) is generated for the validation only. Used by the Managed layer to freeze an invoice before its documents are rendered; the validation always runs, whatever the validation mode.
  • RenderedDocumentRendered quote, delivery note, reminder or other document (PDF and HTML, never XML).
  • RenderedInvoiceResult of a render run. With several formats, every format is reachable via {@see self::as()}; all share the same calculation.
  • RenderOptionsPer call options of a render run; unset values fall back to the configuration.

Quittio\Core\Serialization

  • ArrayHydratorBuilds DTOs from plain arrays (the inverse of ArrayNormalizer).
  • ArrayNormalizerConverts DTOs into plain arrays (scalars only) for JSON, storage and APIs.
  • JsonSchemaGeneratorGenerates the JSON Schema (draft 2020-12) of InvoiceData::toArray() from the constructor signatures and mapping attributes, so that the schema never drifts from the model.
  • JsonSchemaValidatorValidates JSON input against the shipped invoice schema before hydration (requires the optional package opis/json-schema).

Quittio\Core\Serialization\Snapshots

  • SnapshotUpcaster interfaceMigrates a stored invoice snapshot from one version to the next one.
  • SnapshotUpcasterChainBrings stored snapshots step by step to the current version (v1 → v2 → … → current).
  • SnapshotVersionExceptionA snapshot cannot be brought to the current version: an upcaster is missing, or the snapshot was written by a newer version of the package.

Quittio\Core\Standards

Quittio\Core\Support

  • AmountFactory for monetary amounts.
  • DateCalendar date without time of day.
  • DatedValuesValues that change on dates, e.g. tax rates or reference interest rates: every value holds from its date until the next change.
  • DecimalHelpers for exact decimal arithmetic. Floats are rejected on purpose, see rejectFloat().
  • Macroable traitLightweight macro support without a dependency on Laravel. Country packs use it to add helpers such as smallAmount() to the invoice builder.
  • ProcessMinimal external process runner with stdin, timeout and captured output.

Quittio\Core\Tax

  • CountryDefaultVatDefault VAT of lines without VAT treatment, for InvoiceBuilder::useDefaultVat():
  • CustomTaxPresetAd-hoc tax preset, e.g. for an exemption with a specific legal reference.
  • DatedTaxPreset interfaceA preset whose rate depends on the date of the supply, e.g. a standard rate that was lowered for half a year. The builder resolves it with the supply date of each line (SupplyDate); rate() returns the rate of today.
  • StatesInvoiceNote interfaceA preset that requires a note on the invoice, e.g. a statement the law prescribes for the special scheme of the preset. The builder adds the note once (BT-22, subject REG) when a line uses the preset, unless the invoice has a note with the same text already.
  • SupplyDateThe date that decides the VAT rate of a line: the end of the line period (BT-135), its start (BT-134), the VAT point date (BT-7), the actual delivery date (BT-72), the end of the invoicing period (BT-74) and finally the issue date (BT-2), in this order.
  • TaxPreset interfaceA named VAT treatment provided by a country pack, e.g. "standard rate 19 %" or "small business exemption". Presets set category, rate, VATEX code and legal note text.
  • TaxPresetCollection

Quittio\Core\Templates

  • PhpTemplateEnginePlain PHP templates for use without Laravel.
  • TemplateEngine interfaceTurns the view model into HTML for the PDF renderer (Blade, plain PHP, Twig …).

Quittio\Core\Testing

  • InvoiceFactoryTest data factory: InvoiceData::factory()->reverseCharge()->withLines(5)->make().
  • ScenariosExample invoices for previews, tests and the official validation runs.

Quittio\Core\Validation

  • InvoiceValidatorRuns all configured validation drivers and merges their results.
  • MessagesCreates validation messages from the message catalog.
  • Rule interfaceA business or plausibility rule checked in PHP (levels L1 to L3 and L7).
  • RuleOverridesChanges to the PHP rules by rule code: rules switched off, findings with another severity and rules replaced by own implementations. Codes match exactly or, with a trailing "*", by prefix (e.g. "DE-USTG-*"). The overrides apply to the PHP rules only; the findings of the XSD schema, KoSIT and veraPDF are never changed.
  • Severity enum
  • ValidationContextInformation available to rules while validating an invoice.
  • ValidationDriver interfaceA validation driver checks one or more levels (PHP rules, XSD, KoSIT, veraPDF, …).
  • ValidationExceptionThrown when an invoice does not pass validation. The full result is attached.
  • ValidationLevel enumValidation levels.
  • ValidationMessageA single validation finding.
  • ValidationResultResult of a validation run.
  • ValidationSubjectWhat is validated: the calculated data and, where available, the generated XML and PDF.

Quittio\Core\Validation\Drivers

  • KositArtifactsDownloads the KoSIT validator and the XRechnung validator configuration (level L5) and compiles the Peppol BIS Billing 3.0 Schematron to XSLT with the Saxon bundled in the validator (requires Java).
  • KositReportParserConverts a KoSIT validator report (VARL) into validation messages.
  • KositValidatorOfficial Schematron validation (level L5) with the KoSIT validator.
  • PhpRulesDriverBuilt-in PHP rules: levels L1 (structure), L2 (profile), L3 (business rules) and L7 (plausibility).
  • VeraPdfValidatorPDF/A conformance check (level L6) with veraPDF.
  • XsdValidatorXML schema validation (level L4) with the bundled CII D16B and UBL 2.1 schemas. XML of another syntax read by the reader of a country pack (e.g. ebInterface) is not checked here: the reader checks its structure.

Quittio\Core\Validation\Plausibility

  • IbanIBAN check digit validation (ISO 13616, mod 97-10) without extensions.
  • VatIdFormatFormat of VAT identification numbers by country prefix (structure only, no check digits).
  • VatIdVerificationResult of an online VAT identifier check. $valid is null if no statement is possible: the service was not reachable or answered with an error, or it does not cover the identifier ($supported = false).
  • VatIdVerifier interfaceOnline check of VAT identifiers (e.g. EU VIES). Implementations must never throw because a service is unavailable; they return a result with $valid = null instead.
  • ViesVerifierVAT identifier check via the REST interface of the EU VIES service.

Quittio\Core\Validation\Rules

  • CallbackRuleA rule defined by a closure. The closure receives the invoice and a reporter.
  • CodeListRulesCode list rules of EN 16931 (BR-CL-…), based on the official code lists.
  • En16931RulesEN 16931 business rules (BR-…) and conditions (BR-CO-…) checked on the data model.
  • FieldMatrixRuleMandatory and allowed fields of the selected profile (level L2), derived from the mapping attributes of the data model and the profile's additional requirements.
  • InspectHelpers shared by the rule sets.
  • PeppolRulesThe Peppol BIS Billing 3.0 rules (PEPPOL-EN16931-…, PEPPOL-COMMON-…) that the data of an invoice can violate, with readable messages. Rules that the UBL writer always satisfies and rules covered by an identical EN 16931 rule are not repeated (docs/validation.md lists them). The complete rule set is checked with the official artifacts (level L5).
  • PlausibilityRulesPlausibility checks (level L7): IBAN check digits, BIC and VAT identifier formats, e-mail addresses, date logic and the VAT category against the destination country. The VIES check is added only if a verifier is given.
  • QuittioRulesPackage rules (QUITTIO-…) that go beyond EN 16931.
  • RuleReporterCollects the findings of one rule.
  • StructureRulesStructure and data format checks of the data model (level L1).
  • VatCategoryRulesVAT category rules of EN 16931 (BR-S, BR-Z, BR-E, BR-AE, BR-IC, BR-G, BR-O, BR-AF, BR-AG, BR-B).

Quittio\Core\View

  • AccessLogRecords which view model fields a template read (for the mandatory field guard).
  • AddressFormatter interfaceFormats postal addresses according to the conventions of a country.
  • CountryNamesCountry names from ext-intl with the ISO code as fallback.
  • FormattedValueA value for templates: formatted for display and available in raw form. Casting to string returns the formatted value, so {{ $value }} prints it.
  • Formatter interfaceFormats values for display according to a locale.
  • InternationalAddressFormatterFallback address format: street lines, "postcode city", subdivision and, for foreign recipients, the country name in upper case as the last line.
  • IntlFormatterLocale aware formatting with ext-intl and a fallback for German and English conventions.
  • InvoiceTitleLabel key of the document title for a type code (BT-3).
  • InvoiceViewModelThe only object templates receive. Every value is available formatted ($value->formatted or {{ $value }}) and raw ($value->raw).
  • LetterLayoutPosition of the address field and marks on the first page, in millimetres from the top left corner (e.g. DIN 5008 form A/B in the German country pack).
  • MandatoryFieldGuardChecks after rendering that the template printed all mandatory values.
  • MandatoryFieldMissingA template omitted mandatory invoice information.
  • MarkdownSafe Markdown subset for texts: paragraphs, lists, bold and italic. HTML in the input is shown as text, links keep only their text.
  • ResolvedLogoA logo of the presentation as the renderer gets it: a local file or a checked data URI (Pdf\LogoCache), resolved before the view model is built, so that the view layer does no I/O.
  • ViewContextEverything the view model factory needs besides the invoice data.
  • ViewModelFactoryBuilds the template view model from calculated invoice data.
  • ViewNodeRead-only node of the invoice view model with recorded property access.

Quittio\Core\View\Model

Quittio\Core\Xml

  • FormatNumber formats for XML: dot as decimal separator, no grouping, no exponent.
  • PaymentTermsTextBuilds the payment terms text (BT-20) from structured payment terms.
  • SerializationOptionsOptions for XML serialisation.
  • UnsafeXmlExceptionRejected XML input (DOCTYPE, too large, not well-formed).
  • XmlSecuritySafe XML loading for untrusted input.
  • XmlSerializer interfaceWrites calculated invoice data as XML in one syntax.

Quittio\Core\Xml\Cii

  • CiiReaderReads UN/CEFACT Cross Industry Invoices (Factur-X/ZUGFeRD, XRechnung CII) into the data model.
  • CiiWriterWrites UN/CEFACT Cross Industry Invoice (D16B) according to the EN 16931 binding (CEN/TS 16931-3-3) and the Factur-X/ZUGFeRD profiles.

Quittio\Core\Xml\Ubl

  • UblReaderReads UBL 2.1 Invoice and CreditNote documents (EN 16931, XRechnung UBL, Peppol BIS) into the data model.
  • UblWriterWrites OASIS UBL 2.1 Invoice and CreditNote documents according to the EN 16931 binding (CEN/TS 16931-3-2). Credit note type codes produce a CreditNote document.

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