PHPackages                             einfacharchiv/zugferd - 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. einfacharchiv/zugferd

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

einfacharchiv/zugferd
=====================

Convert ZUGFeRD XML to PHP objects

v3.0.0(2y ago)1483MITXSLTPHP ^7.0 || ^8.0

Since Feb 18Pushed 2y ago1 watchersCompare

[ Source](https://github.com/einfachArchiv/zugferd)[ Packagist](https://packagist.org/packages/einfacharchiv/zugferd)[ Docs](https://github.com/einfachArchiv/zugferd)[ RSS](/packages/einfacharchiv-zugferd/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (7)Dependencies (1)Versions (9)Used By (0)

Convert ZUGFeRD XML to PHP objects
==================================

[](#convert-zugferd-xml-to-php-objects)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

This package provides an easy way to convert a ZUGFeRD-invoice.xml to a PHP object.

You can use the [unpack-pdf-attachments package](https://github.com/einfachArchiv/unpack-pdf-attachments) to unpack a ZUGFeRD-invoice.xml from a PDF.

We use both packages in our German SaaS product [einfachArchiv](https://www.einfacharchiv.com).

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

[](#requirements)

PHP 7.0 and later.

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

[](#installation)

You can install this package via [Composer](http://getcomposer.org/). Run the following command:

```
composer require einfacharchiv/zugferd
```

Usage
-----

[](#usage)

Converting a ZUGFeRD XML is easy.

If an element is not present, the method returns `null`.

```
$xml = file_get_contents('path/to/ZUGFeRD-invoice.xml');

// Validates the XML against the ZUGFeRD XSD.
if (Validator::isValid($xml)) {
    $reader = new Reader($xml);

    // Available methods
    // Context
    $reader->getType();

    // Header
    $reader->getId();
    $reader->getName();
    $reader->getTypeCode();
    $reader->getIssueDate()->toDateTimeString();

    foreach ($reader->getNotes() as $note) {
        $note->getNote();
    }

    // Seller
    $reader->getSeller()->getName();
    $reader->getSeller()->getLineOne();
    $reader->getSeller()->getLineTwo();
    $reader->getSeller()->getZip();
    $reader->getSeller()->getCity();
    $reader->getSeller()->getCountry();

    foreach ($reader->getSeller()->getTaxNumbers() as $taxNumber) {
        $taxNumber->getNumber();
        $taxNumber->getType();
    }

    // Buyer
    $reader->getBuyer()->getId();
    $reader->getBuyer()->getName();
    $reader->getBuyer()->getLineOne();
    $reader->getBuyer()->getLineTwo();
    $reader->getBuyer()->getZip();
    $reader->getBuyer()->getCity();
    $reader->getBuyer()->getCountry();

    foreach ($reader->getBuyer()->getTaxNumbers() as $taxNumber) {
        $taxNumber->getNumber();
        $taxNumber->getType();
    }

    // Delivery
    $reader->getOccurrenceDate()->toDateTimeString();

    // Settlement
    $reader->getPaymentReference();
    $reader->getCurrency();

    foreach ($reader->getPaymentMethods() as $paymentMethod) {
        $paymentMethod->getTypeCode();
        $paymentMethod->getInformation();

        $paymentMethod->getFinancialAccount()->getIban();
        $paymentMethod->getFinancialAccount()->getName();
        $paymentMethod->getFinancialAccount()->getId();

        $paymentMethod->getFinancialInstitution()->getBic();
        $paymentMethod->getFinancialInstitution()->getName();
    }

    foreach ($reader->getTaxes() as $tax) {
        $tax->getTax()->getAmount();
        $tax->getTax()->getCurrency();

        $tax->getTypeCode();

        $tax->getBasisAmount()->getAmount();
        $tax->getBasisAmount()->getCurrency();

        $tax->getCategoryCode();
        $tax->getPercentage();
    }

    $reader->getLineTotal()->getAmount();
    $reader->getLineTotal()->getCurrency();

    $reader->getChargeTotal()->getAmount();
    $reader->getChargeTotal()->getCurrency();

    $reader->getAllowanceTotal()->getAmount();
    $reader->getAllowanceTotal()->getCurrency();

    $reader->getTaxBasisTotal()->getAmount();
    $reader->getTaxBasisTotal()->getCurrency();

    $reader->getTaxTotal()->getAmount();
    $reader->getTaxTotal()->getCurrency();

    $reader->getGrandTotal()->getAmount();
    $reader->getGrandTotal()->getCurrency();

    $reader->getTotalPrepaid()->getAmount();
    $reader->getTotalPrepaid()->getCurrency();

    $reader->getTotalAllowanceCharge()->getAmount();
    $reader->getTotalAllowanceCharge()->getCurrency();

    $reader->getDuePayable()->getAmount();
    $reader->getDuePayable()->getCurrency();

    foreach ($reader->getPaymentTerms() as $paymentTerms) {
        $paymentTerms->getDescription();
        $paymentTerms->getDueDate()->toDateTimeString();
    }
}
```

Contributing
------------

[](#contributing)

Contributions are **welcome**.

We accept contributions via Pull Requests on [Github](https://github.com/einfachArchiv/zugferd).

Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improvement? Feel free to [create an issue on GitHub](https://github.com/einfachArchiv/zugferd/issues), we'll try to address it as soon as possible.

If you've found a security issue, please email  instead of using the issue tracker.

**Happy coding**!

Credits
-------

[](#credits)

- [Philip Günther](https://github.com/Pag-Man)
- [All Contributors](https://github.com/einfachArchiv/zugferd/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity71

Established project with proven stability

 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 ~278 days

Recently: every ~487 days

Total

8

Last Release

737d ago

Major Versions

v1.2 → v2.02019-02-24

v2.0 → v3.0.02024-06-22

PHP version history (3 changes)v1.0PHP &gt;=7.0

v2.0PHP ~7.0

v3.0.0PHP ^7.0 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7369d061aa626fd1c448315ca5e53d01daf448c6e5f37be95a46946cda406e8e?d=identicon)[Pag-Man](/maintainers/Pag-Man)

---

Top Contributors

[![philipgunther](https://avatars.githubusercontent.com/u/15112900?v=4)](https://github.com/philipgunther "philipgunther (1 commits)")

---

Tags

pdfphpxmlzugferdphppdfxmlZUGFeRDeinfachArchiv

### Embed Badge

![Health badge](/badges/einfacharchiv-zugferd/health.svg)

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

###  Alternatives

[atgp/factur-x

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

149883.7k4](/packages/atgp-factur-x)[pontedilana/php-weasyprint

PHP library allowing PDF generation from an url or a html page. Wrapper for Kozea/WeasyPrint.

781.2M14](/packages/pontedilana-php-weasyprint)[daandesmedt/phpheadlesschrome

A PHP wrapper for using Google Chrome Headless mode. Convert URL or HTML to a PDF / screenshot. Easy to use and OOP interfaced.

92250.1k](/packages/daandesmedt-phpheadlesschrome)[kartik-v/mpdf

A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support. This is a fork of the official mPDF library.

38329.7k1](/packages/kartik-v-mpdf)[kiwilan/php-ebook

PHP package to read metadata and extract covers from eBooks, comics and audiobooks.

3817.3k2](/packages/kiwilan-php-ebook)[renatio/dynamicpdf-plugin

October HTML to PDF converter using dompdf library.

3013.4k3](/packages/renatio-dynamicpdf-plugin)

PHPackages © 2026

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