Quittio 0.3 API

InvoiceReader
in package

FinalYes

Reads e-invoices from XML or PDF.

Detects the syntax and profile, keeps the declared totals and reports differences to a recalculation instead of correcting them silently.

Table of Contents

Constants

NS_ZUGFERD_1  : string = 'urn:ferd:CrossIndustryDocument:invoice:1p0'
Namespace of ZUGFeRD 1.0, which is recognised but not supported.

Methods

__construct()  : mixed
defaultReaders()  : array<int, FormatReader>
read()  : ReadResult
Reads the content (bytes) of an XML or PDF e-invoice.
readFile()  : ReadResult
Reads an XML or PDF e-invoice from a local file.
withReader()  : self
A copy that also tries $reader after the readers so far, e.g. for a national format.

Constants

NS_ZUGFERD_1

Namespace of ZUGFeRD 1.0, which is recognised but not supported.

public string NS_ZUGFERD_1 = 'urn:ferd:CrossIndustryDocument:invoice:1p0'

Methods

__construct()

public __construct([array<int, FormatReader>|null $readers = null ][, ProfileRegistry|null $profiles = null ][, TotalsCalculator $calculator = new En16931Calculator() ][, EmbeddedXmlExtractor $pdfExtractor = new PdfEmbeddedFileExtractor() ][, int $maxXmlBytes = XmlSecurity::DEFAULT_MAX_BYTES ]) : mixed
Parameters
$readers : array<int, FormatReader>|null = null
$profiles : ProfileRegistry|null = null
$calculator : TotalsCalculator = new En16931Calculator()
$pdfExtractor : EmbeddedXmlExtractor = new PdfEmbeddedFileExtractor()
$maxXmlBytes : int = XmlSecurity::DEFAULT_MAX_BYTES

read()

Reads the content (bytes) of an XML or PDF e-invoice.

public read(string $content) : ReadResult

The argument is always treated as content, never as a file name; use readFile() for paths.

Parameters
$content : string
Tags
throws
UnsafeXmlException

when the XML is too large, not well-formed or not allowed (DOCTYPE, limits)

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 XML or PDF e-invoice from a local file.

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

when the XML is too large, not well-formed or not allowed (DOCTYPE, limits)

PdfException

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

UnreadableInvoiceException

for an unknown format, ZUGFeRD 1.0, a PDF without an embedded invoice, or a file that does not exist, is not readable or is too large

Return values
ReadResult

withReader()

A copy that also tries $reader after the readers so far, e.g. for a national format.

public withReader(FormatReader $reader) : self
Parameters
$reader : FormatReader
Return values
self
On this page

Search results