PHPackages                             dmt-software/ubl-service - 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. dmt-software/ubl-service

ActiveLibrary

dmt-software/ubl-service
========================

Service to handle UBL documents

0.2.1(1mo ago)0196—0%MITPHPPHP &gt;=8.3

Since Oct 27Pushed 1mo ago1 watchersCompare

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

READMEChangelog (6)Dependencies (2)Versions (7)Used By (0)

UBL service
===========

[](#ubl-service)

Service to create and process UBL xml documents.

Install
-------

[](#install)

```
composer require dmt-software/ubl-service
```

Usage
-----

[](#usage)

### Invoice XML

[](#invoice-xml)

#### Create an UBL Invoice XML

[](#create-an-ubl-invoice-xml)

```
use DMT\Ubl\Service\Entity\Invoice;
use DMT\Ubl\Service\UblService;

/** @var Invoice $invoice */
$service = new UblService();
print $service->toXml($invoice);

// ...
```

#### Process an UBL Invoice XML

[](#process-an-ubl-invoice-xml)

```
use DMT\Ubl\Service\UblService;

$service = new UblService();
$invoice = $service->fromXml('...');

// process the invoice
```

### Transformers

[](#transformers)

#### Create UBL Invoice from DTO

[](#create-ubl-invoice-from-dto)

```
use DMT\Ubl\Service\UblService;
use DMT\Ubl\Service\Transformer\Invoice\SimpleObjectToInvoiceTransformer;
use DMT\Ubl\Service\Objects\Invoice;

/** @var Invoice $invoice */
$service = new UblService();
$ublInvoice = $service->toInvoice($invoice, new SimpleObjectToInvoiceTransformer());
```

#### Fetch DTO from UBL Invoice

[](#fetch-dto-from-ubl-invoice)

```
use DMT\Ubl\Service\UblService;
use DMT\Ubl\Service\Transformer\Invoice\InvoiceLineToSimpleObjectTransformer;
use DMT\Ubl\Service\Entity\Invoice;

/** @var Invoice $ublInvoice */
$service = new UblService();
$invoice = $service->fromInvoice($ublInvoice, new InvoiceLineToSimpleObjectTransformer());
```

### Validation

[](#validation)

```
use DMT\Ubl\Service\UblService;
use InvalidArgumentException;

$service = new UblService();
try {
    // test (and formats) the identifier
    $identifier = $service->checkIdentifier('0000000000123', 'GTIN');
} catch (InvalidArgumentException) {
    // identifier is invalid
}
```

### Different UBL versions

[](#different-ubl-versions)

By default `toXml` will return an UBL Invoice in PEPPOL BIS Billing 3.0 format.
To change the format you can add the correct format in the call:

```
use DMT\Ubl\Service\Entity\Invoice;
use DMT\Ubl\Service\UblService;

/** @var Invoice $invoice */
$service = new UblService();
print $service->toXml($invoice, Invoice::VERSION_NLCIUS);

// output is according to the NLCIUS format
```

It is possible to change format from an existing XML by creating an invoice using `fromXML` followed by `toXML` with a different format.

> NOTE: When changing format, especially from new to older one, some data may be lost or invalid.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance89

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.9% 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

Recently: every ~34 days

Total

6

Last Release

55d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec6b7fbb4d231b5c2c76348cf3a13ec5e82c64a1826142f6ec0db1cf15db2873?d=identicon)[proggeler](/maintainers/proggeler)

![](https://www.gravatar.com/avatar/ea1df8d4eb476756f31e2c698e8b2c161c8be1b8482091f930abbddfd8d2fc52?d=identicon)[lingonl](/maintainers/lingonl)

---

Top Contributors

[![proggeler](https://avatars.githubusercontent.com/u/18281353?v=4)](https://github.com/proggeler "proggeler (45 commits)")[![lingonl](https://avatars.githubusercontent.com/u/3777294?v=4)](https://github.com/lingonl "lingonl (12 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dmt-software-ubl-service/health.svg)

```
[![Health](https://phpackages.com/badges/dmt-software-ubl-service/health.svg)](https://phpackages.com/packages/dmt-software-ubl-service)
```

###  Alternatives

[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M626](/packages/jms-serializer-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[horstoeko/zugferd

A library for creating and reading european electronic invoices

4044.3M17](/packages/horstoeko-zugferd)[goetas-webservices/xsd2php-runtime

Convert XSD (XML Schema) definitions into PHP classes

4910.9M36](/packages/goetas-webservices-xsd2php-runtime)[sulu/article-bundle

Bundle for managing localized content-rich entities like blog-posts in the Sulu content management system

66409.6k2](/packages/sulu-article-bundle)[webit/w-firma-api

wFirma.pl API

1820.2k](/packages/webit-w-firma-api)

PHPackages © 2026

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