num-num / ubl-invoice
A modern object-oriented PHP library to create valid UBL and Peppol BIS 3.0 files
Installs: 642 892
Dependents: 0
Suggesters: 0
Security: 0
Stars: 124
Watchers: 7
Forks: 94
Open Issues: 6
pkg:composer/num-num/ubl-invoice
Requires
- php: ^7.4 || ^8.0
- doctrine/collections: ^1.8 || ^2.0
- nesbot/carbon: ^2.72 || ^3.11
- sabre/xml: ^4.0
Requires (Dev)
- brianium/paratest: ^6.11
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^9.6
- squizlabs/php_codesniffer: ^3.7
- dev-master
- v2.0.2
- v2.0.1
- v2.0.0
- v2.0.0-beta15
- v2.0.0-beta14
- v2.0.0-beta13
- v2.0.0-beta12
- v2.0.0-beta11
- v2.0.0-beta10
- v2.0.0-beta9
- v2.0.0-beta8
- v2.0.0-beta7
- v2.0.0-beta6
- v2.0.0-beta5
- v2.0.0-beta4
- v2.0.0-beta3
- v2.0.0-beta2
- v2.0.0-beta1
- v2.0.0-alpha3
- v2.0.0-alpha2
- v2.0.0-alpha1
- v1.22.2
- v1.22.1
- v1.22.0
- v1.21.4
- v1.21.3
- v1.21.2
- v1.21.1
- v1.21.0
- v1.20.0
- v1.19.1
- v1.19
- v1.18.2
- v1.18.1
- v1.18
- v1.17
- v1.16
- v1.15.5
- v1.15.4
- v1.15.3
- v1.15.2
- v1.15.1
- v1.15
- v1.14
- v1.13
- v1.12
- v1.11
- v1.10.2
- v1.10.1
- v1.10
- v1.9.6
- v1.9.5
- v1.9.4
- v1.9.3
- v1.9.2
- v1.9.1
- v1.9.0
- v1.8.6
- v1.8.5
- v1.8.4
- v1.8.3
- v1.8.2
- v1.8.1
- v1.8
- v1.7
- v1.6.2
- v1.6.1
- v1.6
- v1.5
- v1.4.2
- v1.4.1
- v1.4
- v1.3
- v1.2
- v1.1.1
- v1.1
- v1.0.0
- dev-fix/invoice-type-code-int-type
- dev-docs/add-documentation-guides
- dev-docs/prepare-2.0-release
- dev-master-1.x
- dev-master-2.0
- dev-fix/php74-union-types
- dev-fix/php74-compatibility
- dev-docs/v2-upgrade-guide
- dev-feature/document-references
- dev-chore/gitignore-ai-agents
This package is auto-updated.
Last update: 2025-12-19 07:52:02 UTC
README
A modern object-oriented PHP library to create and read valid UBL and Peppol BIS 3.0 files. Please feel free to contribute if you are missing features or tags.
Installation and usage
This package is fully compatible with PHP 8.x and also supports PHP 7.4. You can install it using Composer.
$ composer require num-num/ubl-invoice
Creating UBL files
$invoice = (new \NumNum\UBL\Invoice()) ->setUBLVersionId('2.4') ->setId(123); // ... etc, all other props you need $generator = new \NumNum\UBL\Generator(); $ublXml = $generator->invoice($invoice);
Please check some of the example code in the tests/Write folder to see how you can quickly create an UBL file and use all included properties.
Reading UBL files ✨
Need to quickly read UBL files? As of version 2.0, this library now supports UBL file reading. It's simple and easy to use:
$ublReader = \NumNum\UBL\Reader::ubl(); $invoice = $ublReader->parse(file_get_contents($fileName)); var_dump($invoice); // An \NumNum\UBL\Invoice instance with filled properties!
Please check some additional example code in the tests/Read folder.
Upgrading
If you are upgrading from version 1.x to 2.0, please check the UPGRADING.md guide for breaking changes and migration instructions.
Contributing - bug reporting
This library is not 100% UBL/Peppol feature-complete, in the sense that it doesn't (yet) support all UBL XML tags & functionality. "Yet" being the keyword, since this definitely is the long-term goal. However, all common UBL tags that are required to create and read most common invoices and creditnotes are present in the library. This includes tags for discounts, cash discounts, special vat rates, etc...
If you are missing functionality, please feel free to add it :-) Adding additional tags & attributes is very straight-forward. Check out CONTRIBUTING.md for more information.
Are you experiencing a bug? Please feel free to open an issue in the issue tracker!
Documentation
- Getting Started - Quick start guide with installation and basic examples
- Creating Invoices - Detailed invoice creation guide
- Creating Credit Notes - Credit note creation guide
- Reading UBL Files - Parsing existing UBL documents
- Advanced Features - Payment means, attachments, EN16931 compliance
For additional examples, check the unit tests in the tests folder.
Changelog
Since version 2.0, all changelog information can be found on the GitHub Releases page.