In short
With quittio/core, read() reads the content of an XML or PDF file and readFile() a local file. Both recognise CII, UBL and ZUGFeRD/Factur-X PDFs, extract the embedded XML from the PDF and return the values in the same data model you use to create invoices. validateFile() checks the file on all enabled validation levels. Amounts are never corrected silently: Quittio reports differences as QUITTIO-DECLARED-TOTALS.
What an e-invoice contains
An e-invoice is an XML file according to EN 16931, in CII or UBL syntax. With XRechnung you usually get the XML only. With ZUGFeRD (Factur-X in France) you get a PDF/A-3 with the XML embedded as a file. The XML is what counts, not what the PDF shows. More on the formats in the guide ZUGFeRD, XRechnung or Peppol.
| File | Recognised by | Content |
|---|---|---|
| CII XML | root element CrossIndustryInvoice | ZUGFeRD 2.x / Factur-X MINIMUM to EXTENDED, XRechnung CII |
| UBL XML | root element Invoice or CreditNote (UBL 2.1) | EN 16931, XRechnung UBL, Peppol BIS Billing 3.0 |
content starts with %PDF | ZUGFeRD 2.x / Factur-X, XRechnung in a PDF |
Quittio detects the profile from the specification identifier (BT-24). XRechnung counts once the German country pack is registered.
Installation
Without Laravel, the core and the German country pack are enough. In Laravel, install quittio/quittio, which includes the integration.
composer require quittio/core quittio/country-deReading a file
read() always takes the content of the document, never a file name, so you can pass uploads and request bodies directly. readFile() reads a local file:
use Quittio\Laravel\Facades\Quittio;
$read = Quittio::read($request->file('invoice')->get()); // content of an uploaded XML or PDF
$read = Quittio::readFile('/path/to/invoice.pdf'); // or a local file
$invoice = $read->data; // InvoiceData as stated in the document
$invoice->number; // "RE-2026-0042"
$invoice->seller->name; // the supplier
$invoice->totals?->amountDue; // amount due as stated in the document
$read->profile; // detected profile, e.g. "en16931" or "xrechnung"
$read->findings; // problems found while reading, e.g. QUITTIO-DECLARED-TOTALS
$read->embeddedFilename; // for PDFs: factur-x.xml, xrechnung.xml …use Quittio\Core\Quittio;
use Quittio\Country\DE\CountryDE;
$quittio = Quittio::create([], [new CountryDE]);
$read = $quittio->read(file_get_contents($_FILES['invoice']['tmp_name'])); // content of an uploaded XML or PDF
$read = $quittio->readFile('/path/to/invoice.pdf'); // or a local file
$invoice = $read->data; // InvoiceData as stated in the document
$invoice->number; // "RE-2026-0042"
$invoice->seller->name; // the supplier
$invoice->totals?->amountDue; // amount due as stated in the document
$read->profile; // detected profile, e.g. "en16931" or "xrechnung"
$read->findings; // problems found while reading, e.g. QUITTIO-DECLARED-TOTALS
$read->embeddedFilename; // for PDFs: factur-x.xml, xrechnung.xml …The result is a ReadResult. data holds the values as stated in the document, syntax is cii or ubl, declaredTotals the stated totals and xml the XML that was read, for a PDF the embedded one.
Validate before booking
Reading does not validate the whole document. Before you book an invoice, check it on the same levels Quittio uses for its own invoices (EN 16931, XRechnung, Peppol, XSD; plus the KoSIT validator and veraPDF if you enabled them):
$report = Quittio::validateFile($content); // content of an XML or PDF
$report = Quittio::validatePath($path); // or a local file
if (! $report->isValid()) {
// reject the invoice, e.g. show $report->errors()
}$report = $quittio->validateFile($content); // content of an XML or PDF
$report = $quittio->validatePath($path); // or a local file
if (! $report->isValid()) {
// reject the invoice, e.g. show $report->errors()
}How to set up the official validators is explained in the guide Validating e-invoices.
Taking the values into accounting
A complete example: accept an upload, validate it, extract the values for accounting.
use Quittio\Laravel\Facades\Quittio;
$content = $request->file('invoice')->get(); // uploaded PDF or XML
$report = Quittio::validateFile($content);
if (! $report->isValid()) {
return back()->withErrors(array_map(fn ($m) => "[{$m->code}] {$m->message}", $report->errors()));
}
$read = Quittio::read($content);
$invoice = $read->data;
$booking = [
'supplier' => $invoice->seller->name,
'supplier_vat_id' => $invoice->seller->vatId,
'number' => $invoice->number,
'issue_date' => $invoice->issueDate->toIsoString(),
'due_date' => $invoice->dueDate?->toIsoString(),
'amount_due' => (string) $invoice->totals?->amountDue->getAmount(),
'currency' => $invoice->currency,
'iban' => $invoice->paymentInstructions?->primaryCreditTransfer()?->accountId,
'profile' => $read->profile, // e.g. "en16931" or "xrechnung"
];$content = file_get_contents($_FILES['invoice']['tmp_name']); // uploaded PDF or XML
$report = $quittio->validateFile($content);
if (! $report->isValid()) {
return array_map(fn ($m) => "[{$m->code}] {$m->message}", $report->errors()); // e.g. to show them with the form
}
$read = $quittio->read($content);
$invoice = $read->data;
$booking = [
'supplier' => $invoice->seller->name,
'supplier_vat_id' => $invoice->seller->vatId,
'number' => $invoice->number,
'issue_date' => $invoice->issueDate->toIsoString(),
'due_date' => $invoice->dueDate?->toIsoString(),
'amount_due' => (string) $invoice->totals?->amountDue->getAmount(),
'currency' => $invoice->currency,
'iban' => $invoice->paymentInstructions?->primaryCreditTransfer()?->accountId,
'profile' => $read->profile, // e.g. "en16931" or "xrechnung"
];For a ZUGFeRD invoice of 24 hours at €95 net, $booking is:
{"supplier":"Muster GmbH","supplier_vat_id":"DE123456789","number":"RE-2026-0042","issue_date":"2026-10-01","due_date":"2026-10-15","amount_due":"2713.20","currency":"EUR","iban":"DE02120300000000202051","profile":"en16931"}Totals are never corrected silently
Quittio keeps the amounts as stated in the document and recalculates a copy from the lines for comparison. Every difference in the line amounts, the sum of lines, the totals without and with VAT, the VAT total and the amount due is reported as warning QUITTIO-DECLARED-TOTALS, for example:
QUITTIO-DECLARED-TOTALS: Amount due (BT-115): declared 2700.00, recalculated 2713.20.$read->data->totals still holds the stated amount. Whether you reject such an invoice or ask the supplier is up to you.
Findings while reading
The reader is tolerant: it reads as much as possible and reports problems as findings instead of failing. Some examples:
| Code | Meaning |
|---|---|
BR-03 | The issue date (BT-2) is missing or unreadable |
BR-05 | The invoice currency (BT-5) is missing or not an ISO 4217 code |
QUITTIO-READER-UNKNOWN-PROFILE | The specification identifier (BT-24) is not known to this installation |
QUITTIO-READER-PDF-CANDIDATES | The PDF embeds several invoice files with different content |
QUITTIO-DECLARED-TOTALS | The stated amounts differ from the recalculation |
The full list is in the documentation under Reading incoming invoices.
Limits and security
Incoming files come from outside, so Quittio limits what it accepts:
- XML with a DOCTYPE is rejected, so there are no external entities (XXE) and no entity expansion.
- Size limits: XML 10 MB, PDF 25 MB, every decompressed PDF stream 50 MB (configurable).
- Encrypted PDFs cannot be read.
- File names of embedded files are never used as paths.
An exception is thrown only when the document cannot be read at all: an unknown format, ZUGFeRD 1.0 (not EN 16931), a PDF without an embedded invoice, a missing or too large file. All three exception classes implement QuittioException.
On the command line (Laravel)
In Laravel, two Artisan commands show the content of a file and its validation report:
php artisan quittio:read invoice.pdf # number, date, profile, parties, lines, totals, findings
php artisan quittio:read invoice.xml --json # InvoiceData as JSON
php artisan quittio:validate invoice.pdf # validation reportWithout Laravel there are no console commands; read() and validateFile() return the same data.