Search by

oxygensuite / php-peppol-dto

isarantoglou

Framework-agnostic PHP data transfer objects for Peppol BIS Billing 3.0 documents (UBL Invoice, Credit Note, Invoice Response) and Peppol reporting (EUSR, TSR), with UBL XML rendering.

Package info

github.com/oxygensuite/php-peppol-dto

pkg:composer/oxygensuite/php-peppol-dto

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-09-09 10:15 UTC

This package is auto-updated.

Last update: 2026-09-09 11:11:58 UTC


README

Framework-agnostic PHP data transfer objects for Peppol documents, extracted from the Oxygen Peppol access point so that other OxygenSuite packages can build and read the same documents without depending on Laravel.

What is included

Namespace Purpose
OxygenSuite\PeppolDto\Invoice\Invoice UBL Invoice (Peppol BIS Billing 3.0), root of the cac:/cbc: element tree
OxygenSuite\PeppolDto\CreditNote\CreditNote UBL Credit Note, same model with CreditNoteTypeCode / CreditNoteLine
OxygenSuite\PeppolDto\Invoice\* Every aggregate the billing documents are made of: parties, addresses, lines, items, prices, tax totals, monetary totals, payment means, references, attachments
OxygenSuite\PeppolDto\Invoice\ApplicationResponse XPath reader for an inbound Invoice Response (ApplicationResponse)
OxygenSuite\PeppolDto\EndUserStatisticsReport\* Peppol End User Statistics Report (EUSR)
OxygenSuite\PeppolDto\TransactionStatisticsReport\* Peppol Transaction Statistics Report (TSR)
OxygenSuite\PeppolDto\Xml\InvoiceXmlWriter Serialises an Invoice or CreditNote to namespaced UBL XML
OxygenSuite\PeppolDto\Concerns\HasDOMXpath Namespace-aware DOMXPath bootstrap used by the readers

Every aggregate extends OxygenSuite\PeppolDto\Type, an ordered property bag that records the XML namespace prefix (cbc/cac) and attributes (currencyID, schemeID, unitCode, ...) of each element, so a document can be rendered without any further mapping.

Usage

use OxygenSuite\PeppolDto\Invoice\Invoice;
use OxygenSuite\PeppolDto\Invoice\LegalMonetaryTotal;

$invoice = (new Invoice())
    ->setID('888888888|14/01/2026|0|1.1|A|14')
    ->setIssueDate('2026-01-14')
    ->setInvoiceTypeCode(380)
    ->setDocumentCurrencyCode('EUR')
    ->setLegalMonetaryTotal(
        (new LegalMonetaryTotal())
            ->setLineExtensionAmount(100.0, 'EUR')
            ->setTaxExclusiveAmount(100.0, 'EUR')
            ->setTaxInclusiveAmount(124.0, 'EUR')
            ->setPayableAmount(124.0, 'EUR')
    );

$xml = $invoice->toXML();

Setters accept null for optional elements; null, empty strings and empty aggregates are skipped when rendering. Invoice, CreditNote, Party and AdditionalDocumentReference declare their schema element order, so setters may be called in any order. The Standard Business Document envelope (SBDH) is not part of this package.

Development

composer install
composer test   # phpunit
composer lint   # pint