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
defaultReaders()
public
static defaultReaders() : array<int, FormatReader>
Return values
array<int, FormatReader>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
Return values
ReadResultreadFile()
Reads an XML or PDF e-invoice from a local file.
public
readFile(string $path) : ReadResult
Parameters
- $path : string
Tags
Return values
ReadResultwithReader()
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