PHPackages                             pondersource/invoice-ubl - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. pondersource/invoice-ubl

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

pondersource/invoice-ubl
========================

A library for valid EN16931 UBL files

2.0.2(4y ago)74282[1 PRs](https://github.com/pondersource/invoice-ubl/pulls)MITPHPPHP ^7.1

Since Feb 11Pushed 3y ago2 watchersCompare

[ Source](https://github.com/pondersource/invoice-ubl)[ Packagist](https://packagist.org/packages/pondersource/invoice-ubl)[ Docs](https://github.com/pondersource/invoice-ubl)[ RSS](/packages/pondersource-invoice-ubl/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (5)Used By (0)

UBL Invoice
-----------

[](#ubl-invoice)

A library for creating a valid UBL files in PHP like standard EN16931.l A key objective of the European standard on eInvoicing (EN) is to make it possible for sellers to send invoices to many customers by using a single eInvoicing format and thus not having to adjust their sending and/or receiving to connect with individual trading parties.

### Requirements

[](#requirements)

- PHP 7.2
- composer

Installation
------------

[](#installation)

```
composer require pondersource/invoice-ubl

```

```
composer install

```

### Check pass all test case for Invoices standard

[](#check-pass-all-test-case-for-invoices-standard)

```
vendor/bin/phpunit

```

### Usage for show classes in Invoice that you will generate

[](#usage-for-show-classes-in-invoice-that-you-will-generate)

```
include 'vendor/autoload.php';
 // Tax scheme
 $taxScheme = (new \Ishifoev\Invoice\Party\TaxScheme())
 ->setId('VAT');

  // Client contact node
  $clientContact = (new \Ishifoev\Invoice\Account\Contact())
   ->setName('Client name')
   ->setTelephone('908-99-74-74');

$country = (new \Ishifoev\Invoice\Account\Country())
            ->setIdentificationCode('NL');

        // Full address
$address = (new \Ishifoev\Invoice\Account\PostalAddress())
                ->setStreetName('Lisk Center Utreht')
                ->setAddionalStreetName('De Burren')
                ->setCityName('Utreht')
                ->setPostalZone('3521')
                ->setCountry($country);

$financialInstitutionBranch = (new \Ishifoev\Invoice\Financial\FinancialInstitutionBranch())
                ->setId('RABONL2U');

$payeeFinancialAccount = (new \Ishifoev\Invoice\Financial\PayeeFinancialAccount())
               ->setFinancialInstitutionBranch($financialInstitutionBranch)
                ->setName('Customer Account Holder')
                ->setId('NL00RABO0000000000');

$paymentMeans = (new  \Ishifoev\Invoice\Payment\PaymentMeans())
                ->setPayeeFinancialAccount($payeeFinancialAccount)
                ->setPaymentMeansCode(31, [])
                ->setPaymentId('our invoice 1234');

 // Supplier company node
 $supplierLegalEntity = (new \Ishifoev\Invoice\Legal\LegalEntity())		// $doc = new DOMDocument();
		// $doc->load($path);
 ->setRegistrationNumber('PonderSource')
 ->setCompanyId('NL123456789');

$supplierPartyTaxScheme = (new \Ishifoev\Invoice\Party\PartyTaxScheme())
 ->setTaxScheme($taxScheme)
 ->setCompanyId('NL123456789');

$supplierCompany = (new \Ishifoev\Invoice\Party\Party())
 ->setEndPointId('7300010000001', '0007')
 ->setPartyIdentificationId('99887766')
 ->setName('PonderSource')
 ->setLegalEntity($supplierLegalEntity)
 ->setPartyTaxScheme($supplierPartyTaxScheme)
 ->setPostalAddress($address);

// Client company node
$clientLegalEntity = (new \Ishifoev\Invoice\Legal\LegalEntity())
 ->setRegistrationNumber('Client Company Name')
 ->setCompanyId('Client Company Registration');

$clientPartyTaxScheme = (new \Ishifoev\Invoice\Party\PartyTaxScheme())
 ->setTaxScheme($taxScheme)
 ->setCompanyId('BE123456789');

$clientCompany = (new \Ishifoev\Invoice\Party\Party())
->setPartyIdentificationId('9988217')
->setEndPointId('7300010000002', '0002')
 ->setName('Client Company Name')
 ->setLegalEntity($clientLegalEntity)
 ->setPartyTaxScheme($clientPartyTaxScheme)
 ->setPostalAddress($address)
 ->setContact($clientContact);

$legalMonetaryTotal = (new \Ishifoev\Invoice\Legal\LegalMonetaryTotal())
 ->setPayableAmount(10 + 2.1)
 ->setAllowanceTotalAmount(0)
 ->setTaxInclusiveAmount(10 + 2.1)
 ->setLineExtensionAmount(10)
 ->setTaxExclusiveAmount(10);

 $classifiedTaxCategory = (new \Ishifoev\Invoice\Tax\ClassifiedTaxCategory())
 ->setId('S')
 ->setPercent(21.00)
 ->setTaxScheme($taxScheme);

  // Product
  $productItem = (new \Ishifoev\Invoice\Item())
  ->setName('Product Name')
  ->setClassifiedTaxCategory($classifiedTaxCategory)
  ->setDescription('Product Description');

// Price
 $price = (new \Ishifoev\Invoice\Payment\Price())
       ->setBaseQuantity(1)
       ->setUnitCode(\Ishifoev\Invoice\Payment\UnitCode::UNIT)
       ->setPriceAmount(10);

// Invoice Line tax totals
$lineTaxTotal = (new Ishifoev\Invoice\Tax\TaxTotal())
            ->setTaxAmount(2.1);

// InvoicePeriod
$invoicePeriod = (new Ishifoev\Invoice\Invoice\InvoicePeriod())
->setStartDate(new \DateTime());

// Invoice Line(s)
$invoiceLine = (new Ishifoev\Invoice\Invoice\InvoiceLine())
->setId(0)
->setItem($productItem)
->setPrice($price)
->setInvoicePeriod($invoicePeriod)
->setLineExtensionAmount(10)
->setInvoicedQuantity(1);

$invoiceLines = [$invoiceLine];

$taxCategory = (new \Ishifoev\Invoice\Tax\TaxCategory())
            ->setId('S', [])
            ->setPercent(21.00)
            ->setTaxScheme($taxScheme);

$allowanceCharge = (new \Ishifoev\Invoice\AllowanceCharge())
->setChargeIndicator(true)
->setAllowanceReason('Insurance')
->setAmount(10)
->setTaxCategory($taxCategory);

 $taxSubTotal = (new \Ishifoev\Invoice\Tax\TaxSubTotal())
            ->setTaxableAmount(10)
            ->setTaxAmount(2.1)
            ->setTaxCategory($taxCategory);

$taxTotal = (new \Ishifoev\Invoice\Tax\TaxTotal())
            ->setTaxSubtotal($taxSubTotal)
            ->setTaxAmount(2.1);

   // Payment Terms
$paymentTerms = (new \Ishifoev\Invoice\Payment\PaymentTerms())
   ->setNote('30 days net');

// Delivery
$deliveryLocation = (new \Ishifoev\Invoice\Account\PostalAddress())
->setStreetName('Delivery street 2')
->setAddionalStreetName('Building 56')
->setCityName('Utreht')
->setPostalZone('3521')
->setCountry($country);

$delivery = (new \Ishifoev\Invoice\Account\Delivery())
  ->setActualDeliveryDate(new \DateTime())
  ->setDeliveryLocation($deliveryLocation);

$orderReference = (new \Ishifoev\Invoice\Payment\OrderReference())
  ->setId('5009567')
  ->setSalesOrderId('tRST-tKhM');

   // Invoice object
   $invoice = (new  \Ishifoev\Invoice\Invoice\Invoice())
   ->setProfileID('urn:fdc:peppol.eu:2017')
   ->setCustomazationID('urn:cen.eu:en16931:2017')
   ->setId(1234)
   ->setIssueDate(new \DateTime())
   ->setNote('invoice note')
   ->setAccountingCostCode('4217:2323:2323')
   ->setDelivery($delivery)
   ->setAccountingSupplierParty($supplierCompany)
   ->setAccountingCustomerParty($clientCompany)
   ->setInvoiceLines($invoiceLines)
   ->setLegalMonetaryTotal($legalMonetaryTotal)
   ->setPaymentTerms($paymentTerms)
   //->setAllowanceCharges($allowanceCharge)
   ->setInvoicePeriod($invoicePeriod)
   ->setPaymentMeans($paymentMeans)
   ->setByerReference('BUYER_REF')
   ->setOrderReference($orderReference)
   ->setTaxTotal($taxTotal);

  $generateInvoice = new \Ishifoev\Invoice\Invoice\GenerateInvoice();
  $outputXMLString = $generateInvoice->invoice($invoice);
  $dom = new \DOMDocument;
  $dom->loadXML($outputXMLString);
  $dom->save('EN16931Test.xml');
```

### Output generate XML file EN16931.xml

[](#output-generate-xml-file-en16931xml)

```

 2.1
 urn:cen.eu:en16931:2017
 urn:fdc:peppol.eu:2017
 1234
 2022-01-17
 380
 invoice note
 EUR
 4217:2323:2323
 BUYER_REF

  2022-01-17

  5009567
  tRST-tKhM

   7300010000001

    99887766

    PonderSource

    Lisk Center Utreht
    De Burren
    Utreht
    3521

     NL

    NL123456789

     VAT

    PonderSource
    NL123456789

   7300010000002

    9988217

    Client Company Name

    Lisk Center Utreht
    De Burren
    Utreht
    3521

     NL

    BE123456789

     VAT

    Client Company Name
    Client Company Registration

    Client name
    908-99-74-74

  2022-01-17

    Delivery street 2
    Building 56
    Utreht
    3521

     NL

  31
  our invoice 1234

   NL00RABO0000000000
   Customer Account Holder

    RABONL2U

  30 days net

  2.10

   10.00
   2.10

    S
    21.00

     VAT

  10.00
  10.00
  12.10
  0.00
  12.10

  0
  1.00
  10.00

   2022-01-17

   Product Description
   Product Name

    S
    21.00

     VAT

   10.00
   1.00

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~27 days

Total

3

Last Release

1493d ago

Major Versions

1.0.1 → 2.0.12022-04-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/90cf56bb60a2395a6f8c61ae3ee3b41193bda2cd21049e0e7cbed3385233da7a?d=identicon)[AlexMalikov94](/maintainers/AlexMalikov94)

![](https://www.gravatar.com/avatar/314812d46664b241ac4719c58eca4c93b24dc93b93c6bda9f65488fd0befd150?d=identicon)[michielbdejong](/maintainers/michielbdejong)

---

Top Contributors

[![ishifoev](https://avatars.githubusercontent.com/u/34019391?v=4)](https://github.com/ishifoev "ishifoev (7 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/pondersource-invoice-ubl/health.svg)

```
[![Health](https://phpackages.com/badges/pondersource-invoice-ubl/health.svg)](https://phpackages.com/packages/pondersource-invoice-ubl)
```

###  Alternatives

[phpoffice/phpspreadsheet

PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine

13.9k293.5M1.2k](/packages/phpoffice-phpspreadsheet)[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M100](/packages/spatie-browsershot)[smalot/pdfparser

Pdf parser library. Can read and extract information from pdf file.

2.7k34.5M216](/packages/smalot-pdfparser)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.1k57.6M128](/packages/openspout-openspout)[keboola/csv

Keboola CSV reader and writer

1451.8M21](/packages/keboola-csv)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
