PHPackages                             jh3ady/einvoicing - 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. [Payment Processing](/categories/payments)
4. /
5. jh3ady/einvoicing

ActiveLibrary[Payment Processing](/categories/payments)

jh3ady/einvoicing
=================

Anti-Corruption Layer for European e-invoicing (UBL + Factur-X)

v0.1.0(1mo ago)00MITPHPPHP ^8.1CI passing

Since Apr 5Pushed 1mo agoCompare

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

READMEChangelogDependencies (2)Versions (2)Used By (0)

jh3ady/einvoicing
=================

[](#jh3adyeinvoicing)

PHP 8.1+ library for producing and validating European e-invoices in UBL 2.1 and Factur-X (CII).

[![CI](https://github.com/jh3ady/einvoicing/actions/workflows/ci.yml/badge.svg)](https://github.com/jh3ady/einvoicing/actions/workflows/ci.yml/badge.svg)

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

[](#installation)

```
composer require jh3ady/einvoicing
```

Quick Start
-----------

[](#quick-start)

### 1. Build an invoice

[](#1-build-an-invoice)

```
use Jh3ady\EInvoicing\Enum\CountryCode;
use Jh3ady\EInvoicing\Enum\CurrencyCode;
use Jh3ady\EInvoicing\Enum\InvoiceType;
use Jh3ady\EInvoicing\Enum\TaxCategoryCode;
use Jh3ady\EInvoicing\Model\Invoice;
use Jh3ady\EInvoicing\Model\InvoiceLine;
use Jh3ady\EInvoicing\Model\Item;
use Jh3ady\EInvoicing\Model\MonetaryTotal;
use Jh3ady\EInvoicing\Model\Party;
use Jh3ady\EInvoicing\Model\PostalAddress;
use Jh3ady\EInvoicing\Model\Price;
use Jh3ady\EInvoicing\Model\TaxSubtotal;
use Jh3ady\EInvoicing\Model\TaxTotal;
use Jh3ady\EInvoicing\Model\ValueObject\Amount;
use Jh3ady\EInvoicing\Model\ValueObject\Quantity;

$address = new PostalAddress('10 rue de la Paix', 'Paris', CountryCode::FR, '75002');

$invoice = new Invoice(
    number: 'FA-2024-001',
    issueDate: new \DateTimeImmutable('2024-01-15'),
    type: InvoiceType::Invoice,
    currency: CurrencyCode::EUR,
    seller: new Party(name: 'Seller SAS', address: $address, vatNumber: 'FR12345678901'),
    buyer: new Party(name: 'Buyer SA', address: $address, vatNumber: 'FR98765432101'),
    lines: [
        new InvoiceLine(
            id: '1',
            quantity: new Quantity('2', 'C62'),
            item: new Item(name: 'Consulting service'),
            price: new Price(amount: new Amount('500.00')),
            taxCategory: TaxCategoryCode::StandardRate,
            taxRate: '20.00',
            lineTotal: new Amount('1000.00'),
        ),
    ],
    taxTotal: new TaxTotal(
        taxAmount: new Amount('200.00'),
        subtotals: [
            new TaxSubtotal(
                taxableAmount: new Amount('1000.00'),
                taxAmount: new Amount('200.00'),
                category: TaxCategoryCode::StandardRate,
                taxRate: '20.00',
            ),
        ],
    ),
    monetaryTotal: new MonetaryTotal(
        lineExtensionAmount: new Amount('1000.00'),
        taxExclusiveAmount: new Amount('1000.00'),
        taxInclusiveAmount: new Amount('1200.00'),
        payableAmount: new Amount('1200.00'),
    ),
);
```

### 2. Serialize to UBL 2.1

[](#2-serialize-to-ubl-21)

```
use Jh3ady\EInvoicing\EInvoicing;
use Jh3ady\EInvoicing\Specification;

$xml = EInvoicing::serialize($invoice, Specification::ubl21());
```

### 3. Serialize to Factur-X

[](#3-serialize-to-factur-x)

```
use Jh3ady\EInvoicing\EInvoicing;
use Jh3ady\EInvoicing\Enum\FacturXProfile;
use Jh3ady\EInvoicing\Specification;

$xml = EInvoicing::serialize($invoice, Specification::facturX(FacturXProfile::EN16931));
```

### 4. Validate

[](#4-validate)

```
$result = EInvoicing::validate($invoice, $spec);

if (!$result->isValid()) {
    foreach ($result->errors() as $error) {
        echo "[{$error->code}] {$error->message}\n";
    }
}
```

### 5. Serialize and validate in one step

[](#5-serialize-and-validate-in-one-step)

```
$output = EInvoicing::process($invoice, $spec);

if ($output->isValid()) {
    file_put_contents('invoice.xml', $output->xml);
}
```

Supported Formats
-----------------

[](#supported-formats)

FormatSpecificationUBL 2.1`Specification::ubl21()`Factur-X Minimum`Specification::facturX(FacturXProfile::Minimum)`Factur-X BasicWL`Specification::facturX(FacturXProfile::BasicWL)`Factur-X Basic`Specification::facturX(FacturXProfile::Basic)`Factur-X EN16931`Specification::facturX(FacturXProfile::EN16931)`Factur-X Extended`Specification::facturX(FacturXProfile::Extended)`Sandbox
-------

[](#sandbox)

Une application Laravel/Livewire est incluse dans `sandbox/` pour tester la lib en local :

```
cd sandbox
composer install
cp .env.example .env
php artisan key:generate
php artisan serve
```

Deux modes disponibles :

- **Créer une facture** : formulaire complet avec presets (UBL, Factur-X, avoir)
- **Valider un XML** : collez du XML UBL ou Factur-X, validation complète (règles métier + XSD)

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- ext-dom
- ext-libxml
- ext-bcmath

License
-------

[](#license)

MIT

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

45d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/141402?v=4)[Eugene](/maintainers/jdevelop)[@jdevelop](https://github.com/jdevelop)

---

Top Contributors

[![jh3ady](https://avatars.githubusercontent.com/u/5817251?v=4)](https://github.com/jh3ady "jh3ady (39 commits)")

---

Tags

xmlinvoiceZUGFeRDfactur-xublciiEN16931einvoicing

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jh3ady-einvoicing/health.svg)

```
[![Health](https://phpackages.com/badges/jh3ady-einvoicing/health.svg)](https://phpackages.com/packages/jh3ady-einvoicing)
```

###  Alternatives

[atgp/factur-x

PHP library to manage your Factur-X / ZUGFeRD 2.0 PDF invoices files

144825.5k3](/packages/atgp-factur-x)[horstoeko/zugferd

A library for creating and reading european electronic invoices

4174.3M18](/packages/horstoeko-zugferd)[horstoeko/zugferdublbridge

Convert Factur-X/ZUGFeRD (CII-Syntax) to PEPPOL (UBL-Syntax) and visa versa

16135.6k5](/packages/horstoeko-zugferdublbridge)[num-num/ubl-invoice

A modern object-oriented PHP library to create and read valid UBL and EN 16931/Peppol BIS 3.0 files

136820.5k](/packages/num-num-ubl-invoice)[josemmo/einvoicing

Library for reading and creating European-compliant electronic invoices (EN 16931)

173279.6k2](/packages/josemmo-einvoicing)[easybill/e-invoicing

A package to read and create EN16931 e-invoices or CIUS like: XRechnung, ZUGFeRD etc.

12122.5k](/packages/easybill-e-invoicing)

PHPackages © 2026

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