### Run basic InvoiceSuite examples Source: https://github.com/horstoeko/invoicesuite/wiki/Examples Run the basic examples from a checked-out InvoiceSuite project with Composer dependencies installed. Some examples depend on output from another example or on local files in tests/assets. ```bash php examples/01_BuildInvoice.php php examples/02_ReadInvoice.php php examples/03_BuildPdfInvoice.php ``` -------------------------------- ### Complete minimal example with default template Source: https://github.com/horstoeko/invoicesuite/wiki/Visualization A complete example that creates a visualizer, sets the default template, renders HTML markup, and writes it to a file. This is a good starting point for developing custom templates because HTML is easier to inspect than PDF. ```php use horstoeko\invoicesuite\InvoiceSuiteDocumentReader; use horstoeko\invoicesuite\visualizers\InvoiceSuiteVisualizer; $reader = InvoiceSuiteDocumentReader::createFromFile(__DIR__ . '/invoice.xml'); $visualizer = InvoiceSuiteVisualizer::createFromDocumentReader($reader) ->setDefaultTemplate(); $html = $visualizer->renderMarkup(); file_put_contents(__DIR__ . '/invoice-preview.html', $html); ``` -------------------------------- ### Run typical InvoiceSuite example sequence Source: https://github.com/horstoeko/invoicesuite/wiki/Examples Typical sequence of examples to run in order. Some examples depend on output from another example or on local files in tests/assets. ```bash php examples/01_BuildInvoice.php php examples/02_ReadInvoice.php php examples/03_BuildPdfInvoice.php php examples/05_Visualizer.php php examples/07_ValidationXsd.php ``` -------------------------------- ### Install horstoeko/invoicesuite with Composer Source: https://github.com/horstoeko/invoicesuite/blob/master/README.md Install the horstoeko/invoicesuite package using Composer. This is the recommended installation method. ```bash composer require "horstoeko/invoicesuite" ``` -------------------------------- ### Build a document with InvoiceSuiteDocumentBuilder Source: https://github.com/horstoeko/invoicesuite/wiki/Architecture Minimal example for creating a document. The provider is selected explicitly via 'zffxextended' because the target format must be known before construction. The provider determines the concrete builder class, root class, serializer setup, and profile-specific behavior. ```php use horstoeko\invoicesuite\InvoiceSuiteDocumentBuilder; $builder = InvoiceSuiteDocumentBuilder::createByProviderUniqueId('zffxextended'); $builder ->setDocumentNo('RE-2026-0001') ->setDocumentCurrency('EUR'); ``` -------------------------------- ### Load example helper file Source: https://github.com/horstoeko/invoicesuite/wiki/Creating-an-electronic-invoice-document Loads an additional helper file used only by the example environment. Not required by InvoiceSuite itself. ```php require __DIR__ . '/00_ExampleHelpers.php'; ``` -------------------------------- ### Install InvoiceSuite via Composer Source: https://github.com/horstoeko/invoicesuite/wiki/Installation Run this command in your project root to install the package and its dependencies. ```sh composer require horstoeko/invoicesuite ``` -------------------------------- ### Minimal header reading example Source: https://github.com/horstoeko/invoicesuite/wiki/Reading-an-electronic-invoice-document Minimal example reading document number, date, and currency, then printing them with printf. Uses null-safe operator for date formatting. ```php $reader->getDocumentNo($documentNumber); $reader->getDocumentDate($documentDate); $reader->getDocumentCurrency($documentCurrency); printf("Invoice %s from %s in currency %s\n", $documentNumber, $documentDate?->format('Y-m-d') ?? '', $documentCurrency ); ``` -------------------------------- ### Verify Installation with InvoiceSuiteDocumentBuilder Source: https://github.com/horstoeko/invoicesuite/wiki/Installation Use this snippet to confirm that the package is installed and the autoloader is configured correctly. ```php use horstoeko\invoicesuite\InvoiceSuiteDocumentBuilder; $builder = InvoiceSuiteDocumentBuilder::createByProviderUniqueId('zffxcomfort'); ``` -------------------------------- ### Example file template with $document Source: https://github.com/horstoeko/invoicesuite/wiki/Visualization Tiny example template for the file renderer. The variable $document is available and contains the InvoiceSuiteDocumentReader. ```html getDocumentNo($documentNo); $document->getDocumentDate($documentDate); $document->getDocumentBuyerName($buyerName); ?>

Invoice

Date: format('Y-m-d'); ?>

Buyer:

``` -------------------------------- ### Restarting and reading billing periods with firstDocumentBillingPeriod() Source: https://github.com/horstoeko/invoicesuite/wiki/Reading-an-electronic-invoice-document Restarts reading billing periods from the beginning using firstDocumentBillingPeriod() and then iterates with a do-while loop calling nextDocumentBillingPeriod(). The example formats start and end dates with nullable-safe calls and prints them. ```php if ($reader->firstDocumentBillingPeriod()) { do { $reader->getDocumentBillingPeriod($startDate, $endDate, $description); echo sprintf( "%s - %s (%s)\n", $startDate?->format('Y-m-d') ?? '', $endDate?->format('Y-m-d') ?? '', $description ); } while ($reader->nextDocumentBillingPeriod()); } ``` -------------------------------- ### fromFile Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuitePdfExtractor Static method to start getting attached files from a PDF file. ```APIDOC ## fromFile (static) ### Description Start getting attached files from a PDF file. ### Signature ```php public static function fromFile(string $pdfFilename): static ``` ### Parameters - **pdfFilename** (string) - Required - The path to the PDF file. ### Returns - **static** - A new instance of the extractor. ``` -------------------------------- ### Detect invoice format with invoicesuite:detect Source: https://github.com/horstoeko/invoicesuite/wiki/Console-commands The general usage shows the command's arguments and options. The first example detects a structured invoice document (XML example). The second example detects a hybrid PDF invoice document. The third example returns JSON output for a PDF file. ```sh vendor/bin/invoicesuite invoicesuite:detect [options] [--] ``` ```sh vendor/bin/invoicesuite invoicesuite:detect invoice.xml ``` ```sh vendor/bin/invoicesuite invoicesuite:detect invoice.pdf ``` ```sh vendor/bin/invoicesuite invoicesuite:detect invoice.pdf --output-json ``` -------------------------------- ### Typical PDF rendering example with InvoiceSuiteVisualizer Source: https://github.com/horstoeko/invoicesuite/wiki/Visualization A complete example that reads an invoice XML file, creates a visualizer, sets the default template, and renders the PDF to a file. The output is a human-readable PDF and does not embed the machine-readable invoice document. ```php use horstoeko\invoicesuite\InvoiceSuiteDocumentReader; use horstoeko\invoicesuite\visualizers\InvoiceSuiteVisualizer; $reader = InvoiceSuiteDocumentReader::createFromFile(__DIR__ . '/invoice.xml'); InvoiceSuiteVisualizer::createFromDocumentReader($reader) ->setDefaultTemplate() ->renderPdfFile(__DIR__ . '/invoice.pdf'); ``` -------------------------------- ### fromContent Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuitePdfExtractor Static method to start getting attached files from PDF content. ```APIDOC ## fromContent (static) ### Description Start getting attached files from a PDF content. ### Signature ```php public static function fromContent(string $pdfContent): static ``` ### Parameters - **pdfContent** (string) - Required - The PDF content as a string. ### Returns - **static** - A new instance of the extractor. ``` -------------------------------- ### Example: Overwrite target PDF with --force Source: https://github.com/horstoeko/invoicesuite/wiki/Console-commands Overwrites the target PDF file if it already exists by using the --force option. This example embeds invoice.xml into invoice-base.pdf and writes invoice-final.pdf. ```sh vendor/bin/invoicesuite invoicesuite:merge invoice.xml invoice-base.pdf invoice-final.pdf --force ``` -------------------------------- ### Example Blade view with $document Source: https://github.com/horstoeko/invoicesuite/wiki/Visualization Example Blade view for the Laravel renderer. The reader is available as $document. ```blade @php $document->getDocumentNo($documentNo); $document->getDocumentBuyerName($buyerName); @endphp

Invoice {{ $documentNo }}

Buyer: {{ $buyerName }}

``` -------------------------------- ### Provider ID examples Source: https://github.com/horstoeko/invoicesuite/wiki/Implementing-a-custom-provider Examples of stable provider IDs that are short, lowercase, and profile-aware. Avoid marketing names or version numbers unless the version is part of the actual provider identity. ```text myformat myformatbasic myformatcomfort myformatextended ``` -------------------------------- ### getContent Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteDocumentBuilder Get the content as XML string. ```APIDOC ## getContent ### Description Get the content as XML string. ### Method getContent ### Signature ```php public function getContent(): string ``` ### Returns string - The XML content. ``` -------------------------------- ### getDocumentBuyerDescription Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuitePeppol30CreditNoteProviderReader Gets the description of the buyer/customer party. ```APIDOC ## getDocumentBuyerDescription ### Description Gets the description of the buyer/customer party. ### Method N/A (PHP method) ### Signature ```php public function getDocumentBuyerDescription(?string $newDescription): static ``` ### Parameters - **newDescription** (string, nullable) - Additional information about the buyer/customer party. ### Returns - **static** - Returns the current instance for method chaining. ``` -------------------------------- ### getDescription Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteFatturaPaProvider Get a short description for the provider. ```APIDOC ## getDescription ### Description Get a short description for the provider. ### Signature ```php public function getDescription(): string ``` ### Returns - **string** - The description. ``` -------------------------------- ### getDocumentBillingPeriod Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteDocumentReader Get the start and/or end date of the billing period. Sets the start date, end date, and description of the billing period. ```APIDOC ## getDocumentBillingPeriod ### Description Get the start and/or end date of the billing period. Sets the start date, end date, and description of the billing period. ### Method public function getDocumentBillingPeriod(?DateTimeInterface $newStartDate, ?DateTimeInterface $newEndDate, ?string $newDescription): static ### Parameters - **newStartDate** (DateTimeInterface) - Optional - Start of the billing period. - **newEndDate** (DateTimeInterface) - Optional - End of the billing period. - **newDescription** (string) - Optional - Further information of the billing period (Obsolete). ### Returns Returns a value of type __static__. ``` -------------------------------- ### getDocumentPositionBillingPeriod Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteDocumentReader Method to get the billing period start and/or end date from the latest document position. ```APIDOC ## getDocumentPositionBillingPeriod ### Description Gets the start and/or end date of the billing period from the latest position. ### Method public function getDocumentPositionBillingPeriod( ?DateTimeInterface $newStartDate, ?DateTimeInterface $newEndDate, ?string $newDescription, ): static ### Parameters - **newStartDate** (DateTimeInterface) - Optional - Start of the billing period - **newEndDate** (DateTimeInterface) - Optional - End of the billing period - **newDescription** (string) - Optional - Further information of the billing period (Obsolete) ### Returns Returns a value of type __static__ ``` -------------------------------- ### Bootstrap configuration example Source: https://github.com/horstoeko/invoicesuite/wiki/Configuration Shown as a realistic bootstrap block. Because the settings are static and global, configuration is usually performed once during application bootstrap. ```php use horstoeko\invoicesuite\InvoiceSuiteSettings; InvoiceSuiteSettings::setAmountDecimals(4); InvoiceSuiteSettings::setDecimalSeparator('.'); InvoiceSuiteSettings::setUnitAmountDecimals(6); ``` -------------------------------- ### Import ZugferdQuickDescriptor class Source: https://github.com/horstoeko/invoicesuite/wiki/Legacy-support Imports the main quick descriptor class from the compatibility layer. ```php use horstoeko\zugferd\quick\ZugferdQuickDescriptor; ``` -------------------------------- ### Create visualizer from document reader Source: https://github.com/horstoeko/invoicesuite/wiki/Visualization A minimal example that creates a visualizer from an existing document reader. The visualizer still needs a renderer and a template before it can generate markup. ```php use horstoeko\invoicesuite\InvoiceSuiteDocumentReader; use horstoeko\invoicesuite\visualizers\InvoiceSuiteVisualizer; $reader = InvoiceSuiteDocumentReader::createFromFile(__DIR__ . '/invoice.xml'); $visualizer = InvoiceSuiteVisualizer::createFromDocumentReader($reader); ``` -------------------------------- ### Use file template renderer Source: https://github.com/horstoeko/invoicesuite/wiki/Visualization Example of using the file template renderer. setTemplate() must receive a path to a readable template file. ```php use horstoeko\invoicesuite\InvoiceSuiteDocumentReader; use horstoeko\invoicesuite\visualizers\InvoiceSuiteVisualizer; use horstoeko\invoicesuite\visualizers\renderers\InvoiceSuiteVisualizerFileTemplateRenderer; $reader = InvoiceSuiteDocumentReader::createFromFile(__DIR__ . '/invoice.xml'); $visualizer = InvoiceSuiteVisualizer::createFromDocumentReader($reader) ->setRenderer(new InvoiceSuiteVisualizerFileTemplateRenderer()) ->setTemplate(__DIR__ . '/templates/invoice.php'); $html = $visualizer->renderMarkup(); ``` -------------------------------- ### Create a document with the legacy builder Source: https://github.com/horstoeko/invoicesuite/wiki/Legacy-support This example shows the classic builder workflow using the legacy API. It creates a new document with the EN16931 profile, sets document information, seller, buyer, payment means, and a position, then writes the XML to a file. The method names are the legacy API names, and internally the builder forwards to the InvoiceSuite document builder. ```php use DateTime; use horstoeko\zugferd\ZugferdDocumentBuilder; use horstoeko\zugferd\ZugferdProfiles; $document = ZugferdDocumentBuilder::createNew(ZugferdProfiles::PROFILE_EN16931); $document->setDocumentInformation( 'RE-2026-0001', '380', new DateTime('2026-04-03'), 'EUR' ); $document->setDocumentSeller('Supplier Ltd.'); $document->setDocumentSellerAddress('Supplier Street 1', '', '', '10115', 'Berlin', 'DE'); $document->setDocumentBuyer('Customer Inc.'); $document->setDocumentBuyerAddress('Customer Street 10', '', '', '20095', 'Hamburg', 'DE'); $document->addDocumentPaymentMean('58'); $document->addNewPosition('1'); $document->setDocumentPositionProductDetails('Product A'); $document->setDocumentPositionNetPrice(100.00); $document->setDocumentPositionQuantity(1.0, 'H87'); $document->setDocumentPositionTax('S', 'VAT', 19.0); $document->setDocumentPositionLineSummation(100.00); $document->writeFile(__DIR__ . '/invoice.xml'); ``` -------------------------------- ### Render PDF from existing invoice file Source: https://github.com/horstoeko/invoicesuite/wiki/Visualization Creates a visualizer from an existing invoice XML file and renders it to a PDF using the default template. This is the shortest end-to-end example. ```php use horstoeko\invoicesuite\visualizers\InvoiceSuiteVisualizer; $visualizer = InvoiceSuiteVisualizer::createFromFile(__DIR__ . '/invoice.xml') ->setDefaultTemplate(); $visualizer->renderPdfFile(__DIR__ . '/invoice.pdf'); ``` -------------------------------- ### Creator Metadata Methods Source: https://github.com/horstoeko/invoicesuite/wiki/Creating-an-electronic-invoice-pdf-document Methods to get and set the additional creator tool and get the creator tool name for the PDF metadata. ```APIDOC ## getAdditionalCreatorTool() ### Description Returns the additional creator tool name used in the PDF metadata. ### Method GET ### Endpoint N/A (PHP method) ### Parameters None ### Response Returns a string representing the additional creator tool name. ## setAdditionalCreatorTool(string $newAdditionalCreatorTool) ### Description Sets the additional creator tool name to be written into the PDF metadata. ### Method SET ### Endpoint N/A (PHP method) ### Parameters - **$newAdditionalCreatorTool** (string) - Required - The new additional creator tool name. ### Response No return value. ## getCreatorToolName() ### Description Returns the creator tool name used in the PDF metadata. ### Method GET ### Endpoint N/A (PHP method) ### Parameters None ### Response Returns a string representing the creator tool name. ``` -------------------------------- ### Create builder and reader for invoice documents Source: https://github.com/horstoeko/invoicesuite/wiki/Home Shows the primary entry points for creating and reading invoice documents. The builder is instantiated with the provider unique ID 'zffxcomfort', and the reader loads an XML file. This example is XML-focused because all bundled providers currently use XML. ```php use horstoeko\invoicesuite\InvoiceSuiteDocumentBuilder; use horstoeko\invoicesuite\InvoiceSuiteDocumentReader; $builder = InvoiceSuiteDocumentBuilder::createByProviderUniqueId('zffxcomfort'); $reader = InvoiceSuiteDocumentReader::createFromFile(__DIR__ . '/invoice.xml'); ``` -------------------------------- ### addDocumentBillingPeriod Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteDocumentBuilder Adds the start and/or end date of the billing period. Accepts optional start date, end date, and description parameters. ```APIDOC ## addDocumentBillingPeriod ### Description Add a the start and/or end date of the billing period. ### Method addDocumentBillingPeriod ### Signature public function addDocumentBillingPeriod(?DateTimeInterface $newStartDate = null, ?DateTimeInterface $newEndDate = null, ?string $newDescription = null): static ### Parameters - **newStartDate** (DateTimeInterface) - Optional - Start of the billing period - **newEndDate** (DateTimeInterface) - Optional - End of the billing period - **newDescription** (string) - Optional - Further information of the billing period (Obsolete) ### Returns Returns a value of type __static__ ``` -------------------------------- ### setDocumentBillingPeriod Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteDocumentBuilder Sets the start and/or end date of the billing period. Accepts optional start date, end date, and description parameters. ```APIDOC ## setDocumentBillingPeriod ### Description Set the start and/or end date of the billing period. ### Method setDocumentBillingPeriod ### Signature public function setDocumentBillingPeriod(?DateTimeInterface $newStartDate = null, ?DateTimeInterface $newEndDate = null, ?string $newDescription = null): static ### Parameters - **newStartDate** (DateTimeInterface) - Optional - Start of the billing period - **newEndDate** (DateTimeInterface) - Optional - End of the billing period - **newDescription** (string) - Optional - Further information of the billing period (Obsolete) ### Returns Returns a value of type __static__ ``` -------------------------------- ### Implement PDF support methods Source: https://github.com/horstoeko/invoicesuite/wiki/Implementing-a-custom-provider Example implementation of the three PDF support methods. The attachment filename is part of format interoperability; do not invent a filename if the target standard requires a specific one. ```php public function getPdfAllowedAttachmentFilenames(): array { return [ 'myformat-invoice.xml', ]; } public function getPdfDefaultAttachmentFilename(): string { return 'myformat-invoice.xml'; } public function getPdfConstructorClassName(): string { return InvoiceSuiteMyFormatPdfConstructor::class; } ``` -------------------------------- ### Build the document DTO header Source: https://github.com/horstoeko/invoicesuite/wiki/Creating-an-electronic-invoice-document Builds a neutral DTO graph for the document header instead of populating the provider syntax step by step. The example sets a number, description, type, date, notes, and currency on the header DTO. ```php $dtoDocumentHeader = (new InvoiceSuiteDocumentHeaderDTO()) ->setNumber('R87654321012345') ->setDescription('WARENRECHNUNG') ->setType(InvoiceSuiteCodelistDocumentTypes::COMMERCIAL_INVOICE->value) ->setDate(DateTime::createFromFormat('Ymd', '20241115')) ->addNote(new InvoiceSuiteNoteDTO('Es bestehen Rabatt- oder Bonusvereinbarungen.', 'ST3', 'AAK')) ->setCurrency(InvoiceSuiteCodelistCurrencyCodes::EURO->value) ``` -------------------------------- ### Run main quality checks with composer checkstyle:run Source: https://github.com/horstoeko/invoicesuite/blob/master/CONTRIBUTING.md Run this command to execute the main quality checks: lint check, PHP-CS-Fixer in dry-run mode, and PHPStan. The command should be run before committing and must pass. ```bash composer checkstyle:run ``` -------------------------------- ### Import PDF document builder and reader classes Source: https://github.com/horstoeko/invoicesuite/wiki/Home Shows the entry points for hybrid PDF invoices. Use these classes when working with PDF-based electronic invoices. ```php use horstoeko\invoicesuite\InvoiceSuitePdfDocumentBuilder; use horstoeko\invoicesuite\InvoiceSuitePdfDocumentReader; ``` -------------------------------- ### Files created by provider scaffold Source: https://github.com/horstoeko/invoicesuite/wiki/Implementing-a-custom-provider Lists the three files created by the provider scaffold command. Treat these as a starting point, not finished code, and review the provider first before filling in reader or builder methods. ```text InvoiceSuiteMyFormatProvider.php InvoiceSuiteMyFormatProviderReader.php InvoiceSuiteMyFormatProviderBuilder.php ``` -------------------------------- ### getDocumentCompleteDate Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteFatturaPaProviderReader Gets the document period. ```APIDOC ## getDocumentCompleteDate ### Description Gets the document period. ### Method getDocumentCompleteDate ### Signature ```php public function getDocumentCompleteDate(?DateTimeInterface $newCompleteDate): static ``` ### Parameters - **newCompleteDate** (DateTimeInterface) - Optional - Contractual due date of the document ### Returns Returns a value of type __static__ ``` -------------------------------- ### getDocumentLanguage Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteFatturaPaProviderReader Gets the document language. ```APIDOC ## getDocumentLanguage ### Description Gets the document language. ### Method getDocumentLanguage ### Signature ```php public function getDocumentLanguage(?string $newDocumentLanguage): static ``` ### Parameters - **newDocumentLanguage** (string) - Optional - Language indicator. The language code in which the document was written ### Returns Returns a value of type __static__ ``` -------------------------------- ### Create document builder by provider unique ID Source: https://github.com/horstoeko/invoicesuite/wiki/Creating-an-electronic-invoice-document Selects the target format by provider unique ID. The example uses 'zffxcomfort' for Factur-X / ZUGFeRD COMFORT. ```php use horstoeko\invoicesuite\InvoiceSuiteDocumentBuilder; $documentBuilder = InvoiceSuiteDocumentBuilder::createByProviderUniqueId('zffxcomfort'); ``` -------------------------------- ### getDocumentDescription Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteFatturaPaProviderReader Gets the document description. ```APIDOC ## getDocumentDescription ### Description Gets the document description. ### Method getDocumentDescription ### Signature ```php public function getDocumentDescription(?string $newDocumentDescription): static ``` ### Parameters - **newDocumentDescription** (string) - Optional - The documenttype as free text ### Returns Returns a value of type __static__ ``` -------------------------------- ### Get package root and source directories Source: https://github.com/horstoeko/invoicesuite/wiki/Configuration Returns the package root and source directories. Useful in infrastructure code, debugging, testing, or extension scenarios. ```php use horstoeko\invoicesuite\InvoiceSuiteSettings; $rootDir = InvoiceSuiteSettings::getRootDirectory(); $srcDir = InvoiceSuiteSettings::getSourceDirectory(); ``` -------------------------------- ### Read a document with the legacy reader Source: https://github.com/horstoeko/invoicesuite/wiki/Legacy-support This example demonstrates the classic 'read and guess' workflow using the legacy reader. It reads an XML file, retrieves document information, seller, and buyer, and prints them. Internally, the document is detected and parsed through InvoiceSuiteDocumentReader. ```php use horstoeko\zugferd\ZugferdDocumentReader; $reader = ZugferdDocumentReader::readAndGuessFromFile(__DIR__ . '/invoice.xml'); $reader->getDocumentInformation( $documentNo, $documentType, $documentDate, $currency ); $reader->getDocumentSeller($sellerName); $reader->getDocumentBuyer($buyerName); echo $documentNo . PHP_EOL; echo $sellerName . PHP_EOL; echo $buyerName . PHP_EOL; ``` -------------------------------- ### getDocumentSupplyChainEvent Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteDocumentReader Get the date of the delivery. ```APIDOC ## getDocumentSupplyChainEvent ### Description Get the date of the delivery. ### Method public function getDocumentSupplyChainEvent(?DateTimeInterface $newDate): static ### Parameters - **newDate** (DateTimeInterface) - Optional - Actual delivery date ### Returns Returns a value of type __static__ ``` -------------------------------- ### offsetGet Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuitePdfExtractor Gets an attachment by index. ```APIDOC ## offsetGet ### Description Get an attachment by index. ### Signature ```php public function offsetGet(mixed $offset): ?\InvoiceSuitePdfExtractorAttachment ``` ### Parameters - **offset** (mixed) - Required - The index of the attachment. ### Returns - **?\InvoiceSuitePdfExtractorAttachment** - The attachment at the given offset, or null if not found. ``` -------------------------------- ### Create provider scaffold Source: https://github.com/horstoeko/invoicesuite/wiki/Console-commands Creates a provider scaffold with namespace, directory, provider class name, and optional unique ID and description. The directory is created automatically if it does not exist. ```sh vendor/bin/invoicesuite invoicesuite:providers:make \ 'Acme\InvoiceSuite\Providers' \ src/InvoiceSuite/Providers \ AcmeInvoiceProvider \ --unique-id=acmeinvoice \ --description='ACME invoice provider' ``` -------------------------------- ### Import InvoiceSuiteVisualizerAbstractRenderer Source: https://github.com/horstoeko/invoicesuite/wiki/Visualization Import the abstract base class for custom renderers. This is the first step when implementing your own renderer. ```php use horstoeko\invoicesuite\visualizers\renderers\abstracts\InvoiceSuiteVisualizerAbstractRenderer; ``` -------------------------------- ### getParameters Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteFatturaPaProvider Get parameters for the provider. ```APIDOC ## getParameters ### Description Get parameters. ### Signature ```php public function getParameters(): array ``` ### Returns - **array** - The parameters. ``` -------------------------------- ### Folder layout for a custom provider Source: https://github.com/horstoeko/invoicesuite/wiki/Implementing-a-custom-provider Example folder layout for a custom provider. Keep related classes close together, but do not force everything into one directory if the format has many model classes. ```text src/ documents/ providers/ myformat/ InvoiceSuiteMyFormatProvider.php InvoiceSuiteMyFormatProviderReader.php InvoiceSuiteMyFormatProviderBuilder.php InvoiceSuiteMyFormatSerializerHandler.php InvoiceSuiteMyFormatChecksProfiles.php models/ main/ MyFormatInvoice.php MyFormatInvoiceType.php basic/ AmountType.php IdentifierType.php TextType.php xsd/ myformat.xsd ``` -------------------------------- ### getDocumentPosition Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuitePeppol30CreditNoteProviderReader Gets position general information. ```APIDOC ## getDocumentPosition ### Description Gets position general information. ### Method public function ### Signature ```php public function getDocumentPosition( ?string $newPositionId, ?string $newParentPositionId, ?string $newLineStatusCode, ?string $newLineStatusReasonCode, ): static ``` ### Parameters - **newPositionId** (string) - Optional - Identification of the position - **newParentPositionId** (string) - Optional - Identification of the parent position - **newLineStatusCode** (string) - Optional - Indicates whether the invoice item contains prices that must be taken into account when calculating the invoice amount or whether only information is included - **newLineStatusReasonCode** (string) - Optional - Type to specify whether the invoice line is ### Returns Returns a value of type __static__ ``` -------------------------------- ### Add first invoice line with addDocumentPosition() Source: https://github.com/horstoeko/invoicesuite/wiki/Creating-an-electronic-invoice-document Creates the first invoice line by calling addDocumentPosition('1'), then populates product details, gross/net prices, quantities, tax, and summation. The BT references shown in the surrounding list map each method to its corresponding business term (e.g., addDocumentPosition() → BT-126). ```php $documentBuilder->addDocumentPosition('1'); $documentBuilder->setDocumentPositionProductDetails( newProductGlobalId: '4012345001235', newProductGlobalIdType: '0160', newProductSellerId: 'TB100A4', newProductName: 'Trennblätter A4' ); $documentBuilder->setDocumentPositionGrossPrice(9.9000); $documentBuilder->setDocumentPositionNetPrice(9.9000); $documentBuilder->setDocumentPositionQuantities(20.0000, 'H87'); $documentBuilder->setDocumentPositionTax( newTaxCategory: 'S', newTaxType: 'VAT', newTaxPercent: 19.0 ); $documentBuilder->setDocumentPositionSummation(198.00); ``` -------------------------------- ### getDocumentAllowanceCharge Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuitePeppol30CreditNoteProviderReader Method to get the Document Allowance/Charge. ```APIDOC ## getDocumentAllowanceCharge ### Description Gets the Document Allowance/Charge. This method allows setting the charge indicator, allowance/charge amount, base amount, tax category, tax type, tax percent, reason, reason code, and allowance/charge percent. ### Signature ```php public function getDocumentAllowanceCharge( ?bool $newChargeIndicator, ?float $newAllowanceChargeAmount, ?float $newAllowanceChargeBaseAmount, ?string $newTaxCategory, ?string $newTaxType, ?float $newTaxPercent, ?string $newAllowanceChargeReason, ?string $newAllowanceChargeReasonCode, ?float $newAllowanceChargePercent, ): static ``` ### Parameters - **newChargeIndicator** (bool) - Optional - Switch that indicates whether the following data refer to an surcharge or a discount, true means that this an charge - **newAllowanceChargeAmount** (float) - Optional - Amount of the surcharge or discount - **newAllowanceChargeBaseAmount** (float) - Optional - The base amount that may be used in conjunction with the percentage of the surcharge or discount - **newTaxCategory** (string) - Optional - Coded description of the tax category - **newTaxType** (string) - Optional - Coded description of the tax type - **newTaxPercent** (float) - Optional - Tax Rate (Percentage) - **newAllowanceChargeReason** (string) - Optional - Reason given in text form for the surcharge or discount - **newAllowanceChargeReasonCode** (string) - Optional - Reason given as a code for the surcharge or discount - **newAllowanceChargePercent** (float) - Optional - Percentage that may be used, in conjunction with the document level allowance base amount, to calculate the document level allowance or charge amount. To state 20%, use value 20 ### Returns Returns a value of type **static**. ``` -------------------------------- ### Builder write method with guard and tracing Source: https://github.com/horstoeko/invoicesuite/wiki/Implementing-a-custom-provider Example builder write method that traces entry, guards against null/empty values with an early exit, maps the neutral API value to the format model, traces exit, and returns static. Uses InvoiceSuiteStringUtils::stringIsNullOrEmpty for the guard. ```php public function setDocumentNo( ?string $newDocumentNo = null ): static { $this->traceMethodEnter(__METHOD__); if (InvoiceSuiteStringUtils::stringIsNullOrEmpty($newDocumentNo)) { return $this->traceMethodEarlyExit( __METHOD__, 'stringIsNullOrEmpty', 'InvoiceSuiteStringUtils::stringIsNullOrEmpty($newDocumentNo)' ); } $this->getMyFormatRootObject() ->getIDWithCreate() ->setValue($newDocumentNo ?? ''); $this->traceMethodExit(__METHOD__); return $this; } ``` -------------------------------- ### Create reader with createFromFile() Source: https://github.com/horstoeko/invoicesuite/wiki/Reading-an-electronic-invoice-document Creates a reader from an invoice document file on disk. Use this when the document already exists as a file, convenient for scripts, batch jobs, and tests. ```php use horstoeko\invoicesuite\InvoiceSuiteDocumentReader; $reader = InvoiceSuiteDocumentReader::createFromFile(__DIR__ . '/01_SimpleInvoice.xml'); ``` -------------------------------- ### getDocumentInvoiceeDescription Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuitePeppol30CreditNoteProviderReader Gets the description of the invoicee party. ```APIDOC ## getDocumentInvoiceeDescription ### Description Gets the description of the invoicee party. ### Signature ```php public function getDocumentInvoiceeDescription(?string $newDescription): static ``` ### Parameters - **newDescription** (string, nullable) - Additional information about the invoicee party. ### Returns - **static** - Returns the current instance for chaining. ``` -------------------------------- ### getDocumentInvoiceeName Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuitePeppol30CreditNoteProviderReader Gets the name of the Invoicee party. ```APIDOC ## getDocumentInvoiceeName ### Description Gets the name of the Invoicee party. ### Signature ```php public function getDocumentInvoiceeName(?string $newName): static ``` ### Parameters - **newName** (string, nullable) - The full formal name under which the party is registered. ### Returns - **static** - Returns the current instance for chaining. ``` -------------------------------- ### getDocumentInvoicerId Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuitePeppol30CreditNoteProviderReader Gets the ID of the Invoicer party. ```APIDOC ## getDocumentInvoicerId ### Description Gets the ID of the Invoicer party. ### Signature ```php public function getDocumentInvoicerId(?string $newId): static ``` ### Parameters - **newId** (string) - Optional - An identifier of the party. In many systems, identification is key information. ### Returns Returns a value of type **static**. ``` -------------------------------- ### JSON file name mapping example Source: https://github.com/horstoeko/invoicesuite/wiki/Console-commands Illustrates how the JSON output file name is derived from the input PDF file name: invoice.pdf becomes invoice.json. ```text invoice.pdf -> invoice.json ``` -------------------------------- ### getDocumentPayeeAddress Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteFatturaPaProviderReader Gets the address of the Payee party. ```APIDOC ## getDocumentPayeeAddress ### Description Gets the address of the Payee party. ### Method public function getDocumentPayeeAddress(?string $newAddressLine1, ?string $newAddressLine2, ?string $newAddressLine3, ?string $newPostcode, ?string $newCity, ?string $newCountryId, ?string $newSubDivision): static ### Parameters - **newAddressLine1** (string) - Optional - The main line in the address. This is usually the street name and house number or the post office box. - **newAddressLine2** (string) - Optional - Line 2 of the address. This is an additional address line in an address that can be used to provide additional details in addition to the main line. - **newAddressLine3** (string) - Optional - Line 3 of the address. This is an additional address line in an address that can be used to provide additional details in addition to the main line. - **newPostcode** (string) - Optional - Zip code of the city or municipality in which the party's address is located. - **newCity** (string) - Optional - Name of the city or municipality in which the party's address is located. - **newCountryId** (string) - Optional - Country in which the party's address is located. - **newSubDivision** (string) - Optional - Region or federal state in which the party's address is located. ### Returns Returns a value of type **static**. ``` -------------------------------- ### Create reader from content Source: https://github.com/horstoeko/invoicesuite/wiki/Reading-an-electronic-invoice-document Creates a reader from serialized content. Provider detection is automatic; if no provider matches, an exception is thrown. ```php $reader = InvoiceSuiteDocumentReader::createFromContent($documentContent); ``` -------------------------------- ### getDocumentBuyerName Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuitePeppol30CreditNoteProviderReader Gets the name of the buyer/customer party. ```APIDOC ## getDocumentBuyerName ### Description Gets the name of the buyer/customer party. ### Method N/A (PHP method) ### Signature ```php public function getDocumentBuyerName(?string $newName): static ``` ### Parameters - **newName** (string, nullable) - The full formal name under which the party is registered. ### Returns - **static** - Returns the current instance for method chaining. ``` -------------------------------- ### Import InvoiceSuiteVisualizerFileTemplateRenderer Source: https://github.com/horstoeko/invoicesuite/wiki/Visualization Import statement for the default file template renderer class. ```php use horstoeko\invoicesuite\visualizers\renderers\InvoiceSuiteVisualizerFileTemplateRenderer; ``` -------------------------------- ### getDocumentSellerDescription Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuitePeppol30CreditNoteProviderReader Gets the description of the seller/supplier party. ```APIDOC ## getDocumentSellerDescription ### Description Gets the description of the seller/supplier party. ### Method public function getDocumentSellerDescription(?string $newDescription): static ### Parameters - **newDescription** (string) - Required - Further legal information that is relevant for the seller ### Returns Returns a value of type __static__ ``` -------------------------------- ### Rebuild discovery and list providers Source: https://github.com/horstoeko/invoicesuite/wiki/Implementing-a-custom-provider Run these commands after adding or changing a provider to rebuild the autoloader and clear, rebuild, and list the provider cache. ```bash composer dump-autoload vendor/bin/invoicesuite invoicesuite:cache:clear vendor/bin/invoicesuite invoicesuite:cache:rebuild vendor/bin/invoicesuite invoicesuite:providers:list ``` -------------------------------- ### getDocumentSellerName Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuitePeppol30CreditNoteProviderReader Gets the name of the seller/supplier party. ```APIDOC ## getDocumentSellerName ### Description Gets the name of the seller/supplier party. ### Method public function getDocumentSellerName(?string $newName): static ### Parameters - **newName** (string) - Required - the full formal name under which the party is registered ### Returns Returns a value of type __static__ ``` -------------------------------- ### Run unit tests with composer tests Source: https://github.com/horstoeko/invoicesuite/blob/master/CONTRIBUTING.md Run this command to execute the unit tests. It is required to run the relevant unit tests locally before submitting a pull request. ```bash composer tests ``` -------------------------------- ### getDocumentDeliveryTerms Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuitePeppol30CreditNoteProviderReader Gets information on the delivery conditions. ```APIDOC ## getDocumentDeliveryTerms ### Description Gets information on the delivery conditions. ### Method public function getDocumentDeliveryTerms(?string $newCode = null): static ### Parameters - **newCode** (string) - Optional - The code indicating the type of delivery for these commercial delivery terms. To be selected from the entries in the list UNTDID 4053 + INCOTERMS ### Returns Returns a value of type __static__ ``` -------------------------------- ### getDocumentInvoicerAddress Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteFatturaPaProviderReader Gets the address of the Invoicer party. ```APIDOC ## getDocumentInvoicerAddress ### Description Gets the address of the Invoicer party. ### Method public function getDocumentInvoicerAddress ### Signature public function getDocumentInvoicerAddress(?string $newAddressLine1, ?string $newAddressLine2, ?string $newAddressLine3, ?string $newPostcode, ?string $newCity, ?string $newCountryId, ?string $newSubDivision): static ### Parameters - **newAddressLine1** (string) - Optional - The main line in the address. This is usually the street name and house number or the post office box. - **newAddressLine2** (string) - Optional - Line 2 of the address. This is an additional address line in an address that can be used to provide additional details in addition to the main line. - **newAddressLine3** (string) - Optional - Line 3 of the address. This is an additional address line in an address that can be used to provide additional details in addition to the main line. - **newPostcode** (string) - Optional - zip code of the city or municipality in which the party's address is located - **newCity** (string) - Optional - name of the city or municipality in which the party's address is located - **newCountryId** (string) - Optional - country in which the party's address is located - **newSubDivision** (string) - Optional - region or federal state in which the party's address is located ### Returns Returns a value of type __static__ ``` -------------------------------- ### Implement a custom renderer class Source: https://github.com/horstoeko/invoicesuite/wiki/Visualization A minimal custom renderer that extends the abstract base class and implements the required render method. It retrieves the document number and returns an HTML string. ```php use horstoeko\invoicesuite\InvoiceSuiteDocumentReader; use horstoeko\invoicesuite\visualizers\renderers\abstracts\InvoiceSuiteVisualizerAbstractRenderer; class MyCustomRenderer extends InvoiceSuiteVisualizerAbstractRenderer { public function render(InvoiceSuiteDocumentReader $documentReader, mixed $template): string { $documentReader->getDocumentNo($documentNo); return sprintf( "

Invoice %s

Rendered by a custom renderer.

", htmlspecialchars((string)$documentNo, ENT_QUOTES, "UTF-8") ); } } ``` -------------------------------- ### getDocumentSellerId Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteFatturaPaProviderReader Gets the ID of the seller/supplier party. ```APIDOC ## getDocumentSellerId ### Description Gets the ID of the seller/supplier party. ### Method GET ### Endpoint `getDocumentSellerId(?string $newId): static` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **newId** (string) - Optional - An identifier of the party. In many systems, identification is key information. ### Returns Returns a value of type __static__ ``` -------------------------------- ### invoicesuite:visualize usage Source: https://github.com/horstoeko/invoicesuite/wiki/Console-commands Renders an XML or JSON invoice document as human-readable PDF or HTML output. Uses InvoiceSuiteVisualizer::createFromFile(...) and falls back to the built-in default template when no custom template is given. ```sh vendor/bin/invoicesuite invoicesuite:visualize [options] [--] ``` -------------------------------- ### resolveAvailableDocumentFormatProviders Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuitePdfDocumentReader Initialize additional format providers. ```APIDOC ## resolveAvailableDocumentFormatProviders ### Description Initialize additional format providers. ### Method `public function resolveAvailableDocumentFormatProviders(): static` ### Returns Returns a value of type **static**. ``` -------------------------------- ### getDocumentAdditionalReference Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteFatturaPaProviderReader Get an additional associated document. ```APIDOC ## getDocumentAdditionalReference ### Description Get an additional associated document. ### Signature ```php public function getDocumentAdditionalReference( ?string $newReferenceNumber, ?DateTimeInterface $newReferenceDate, ?string $newTypeCode, ?string $newReferenceTypeCode, ?string $newDescription, ?horstoeko\invoicesuite\utils\InvoiceSuiteAttachment $newInvoiceSuiteAttachment, ): static ``` ### Parameters - **newReferenceNumber** (string) - Optional - Additional document number - **newReferenceDate** (DateTimeInterface) - Optional - Additional document date - **newTypeCode** (string) - Optional - Additional document type code - **newReferenceTypeCode** (string) - Optional - Additional document reference-type code - **newDescription** (string) - Optional - Additional document description - **newInvoiceSuiteAttachment** (horstoeko\invoicesuite\utils\InvoiceSuiteAttachment) - Optional - Additional document attachment ### Returns - **static** - Returns a value of type static ``` -------------------------------- ### getDocumentIsTest Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteFatturaPaProviderReader Gets the status of the test indicator. ```APIDOC ## getDocumentIsTest ### Description Gets the status of the test indicator. ### Method getDocumentIsTest ### Signature ```php public function getDocumentIsTest(?bool $newDocumentIsTest): static ``` ### Parameters - **newDocumentIsTest** (bool) - Optional - Indicates that the document is a test ### Returns Returns a value of type __static__ ``` -------------------------------- ### firstDocumentPositionReferencedProduct Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteDocumentReader Moves to the first referenced product in the latest position. ```APIDOC ## firstDocumentPositionReferencedProduct ### Description Moves to the first referenced product in the latest position. ### Method N/A (PHP method) ### Endpoint N/A (PHP method) ### Parameters None ### Request Example N/A ### Response #### Success Response (bool) - **bool** - Returns true if the operation was successful, false otherwise. #### Response Example ```php $result = $reader->firstDocumentPositionReferencedProduct(); ``` ``` -------------------------------- ### getDocumentIsCopy Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteFatturaPaProviderReader Gets the status of the copy indicator. ```APIDOC ## getDocumentIsCopy ### Description Gets the status of the copy indicator. ### Method getDocumentIsCopy ### Signature ```php public function getDocumentIsCopy(?bool $newDocumentIsCopy): static ``` ### Parameters - **newDocumentIsCopy** (bool) - Optional - Indicates that the document is a copy ### Returns Returns a value of type __static__ ``` -------------------------------- ### Import InvoiceSuiteVisualizerStringTemplateRenderer Source: https://github.com/horstoeko/invoicesuite/wiki/Visualization Import statement for the string template renderer class. ```php use horstoeko\invoicesuite\visualizers\renderers\InvoiceSuiteVisualizerStringTemplateRenderer; ``` -------------------------------- ### getDocumentTaxCurrency Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteFatturaPaProviderReader Gets the document tax currency. ```APIDOC ## getDocumentTaxCurrency ### Description Gets the document tax currency. ### Method getDocumentTaxCurrency ### Signature ```php public function getDocumentTaxCurrency(?string $newDocumentTaxCurrency): static ``` ### Parameters - **newDocumentTaxCurrency** (string) - Optional - Code for the tax currency ### Returns Returns a value of type __static__ ``` -------------------------------- ### getDocumentType Source: https://github.com/horstoeko/invoicesuite/wiki/Class-InvoiceSuiteFatturaPaProviderReader Gets the document type code. ```APIDOC ## getDocumentType ### Description Gets the document type code. ### Method getDocumentType ### Signature ```php public function getDocumentType(?string $newDocumentType): static ``` ### Parameters - **newDocumentType** (string) - Optional - The type of the document ### Returns Returns a value of type __static__ ``` -------------------------------- ### Using tracing wrappers Source: https://github.com/horstoeko/invoicesuite/wiki/Implementing-a-custom-provider Usage of the tracing wrappers in normal provider code. traceMethodCall is rarely called directly. ```php $this->traceMethodEnter(__METHOD__); $this->traceMethodExit(__METHOD__); return $this->traceMethodEarlyExit(__METHOD__, 'reason', 'guard'); ```