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

ActivePackage[Payment Processing](/categories/payments)

horstoeko/zugferd-laravel
=========================

A library for Laravel-Framework for creating and reading european electronic invoices

v1.0.5(1y ago)3693.6k↓25%42MITPHPPHP &gt;=7.3CI passing

Since Sep 27Pushed 2mo ago4 watchersCompare

[ Source](https://github.com/horstoeko/zugferd-laravel)[ Packagist](https://packagist.org/packages/horstoeko/zugferd-laravel)[ Docs](https://github.com/horstoeko/zugferd-laravel)[ RSS](/packages/horstoeko-zugferd-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (19)Versions (8)Used By (2)

ZUGFeRD/XRechnung/Factur-X for Laravel
======================================

[](#zugferdxrechnungfactur-x-for-laravel)

[![Latest Stable Version](https://camo.githubusercontent.com/ffbea026bc7e37ebdc34e17ce169cad4babf810e8f91bf72e54e17b2efa2f2b2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f686f7273746f656b6f2f7a7567666572642d6c61726176656c2e7376673f7374796c653d706c6173746963)](https://packagist.org/packages/horstoeko/zugferd-laravel)[![PHP version](https://camo.githubusercontent.com/b85b4cada3a48dcc223a19cb5e4f829822d5652541713ba99ca19143107d7dd1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f686f7273746f656b6f2f7a7567666572642d6c61726176656c2e7376673f7374796c653d706c6173746963)](https://packagist.org/packages/horstoeko/zugferd-laravel)[![License](https://camo.githubusercontent.com/2042acd2f98463b12ad30f31ff5be9c89fbf792e69417b468cceee877c2d0a4a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f686f7273746f656b6f2f7a7567666572642d6c61726176656c2e7376673f7374796c653d706c6173746963)](https://packagist.org/packages/horstoeko/zugferd-laravel)

[![Build Status](https://github.com/horstoeko/zugferd-laravel/actions/workflows/build.ci.yml/badge.svg)](https://github.com/horstoeko/zugferd-laravel/actions/workflows/build.ci.yml)[![Release Status](https://github.com/horstoeko/zugferd-laravel/actions/workflows/build.release.yml/badge.svg)](https://github.com/horstoeko/zugferd-laravel/actions/workflows/build.release.yml)

A simple ZUGFeRD/XRechnung/Factur-X Library for Laravel

Table of Contents
-----------------

[](#table-of-contents)

- [ZUGFeRD/XRechnung/Factur-X for Laravel](#zugferdxrechnungfactur-x-for-laravel)
    - [Table of Contents](#table-of-contents)
    - [License](#license)
    - [Overview](#overview)
    - [Dependencies](#dependencies)
    - [Installation](#installation)
    - [Usage](#usage)
        - [Create a new Document Builder in the MINIMUM-Profile](#create-a-new-document-builder-in-the-minimum-profile)
        - [Create a new Document Builder in the BASIC-Profile](#create-a-new-document-builder-in-the-basic-profile)
        - [Create a new Document Builder in the BASIC-WL-Profile](#create-a-new-document-builder-in-the-basic-wl-profile)
        - [Create a new Document Builder in the EN16931-Profile (COMFORT-Profile)](#create-a-new-document-builder-in-the-en16931-profile-comfort-profile)
        - [Create a new Document Builder in the EXTENDED-Profile](#create-a-new-document-builder-in-the-extended-profile)
        - [Create a new Document Builder in the XRECHNUNG-Profile (Version 2.2)](#create-a-new-document-builder-in-the-xrechnung-profile-version-22)
        - [Create a new Document Builder in the XRECHNUNG-Profile (Version 2.3)](#create-a-new-document-builder-in-the-xrechnung-profile-version-23)
        - [Create a new Document Builder in the XRECHNUNG-Profile (Version 3.0)](#create-a-new-document-builder-in-the-xrechnung-profile-version-30)
        - [Create a Document Reader from an existing XML file](#create-a-document-reader-from-an-existing-xml-file)
        - [Create a Document Reader from an XML string](#create-a-document-reader-from-an-xml-string)
        - [Create a Document Reader from an existing PDF file (which has an attached XML file)](#create-a-document-reader-from-an-existing-pdf-file-which-has-an-attached-xml-file)
        - [Create a merged PDF (XML as attachment) by the output of a ZugferdDocumentBuilder](#create-a-merged-pdf-xml-as-attachment-by-the-output-of-a-zugferddocumentbuilder)
        - [Create a merged PDF by an existing XML file and existing PDF file](#create-a-merged-pdf-by-an-existing-xml-file-and-existing-pdf-file)
        - [Create a merged PDF by an existing XML data string and existing PDF file](#create-a-merged-pdf-by-an-existing-xml-data-string-and-existing-pdf-file)
        - [Create a merged PDF by an existing XML file and a PDF data string](#create-a-merged-pdf-by-an-existing-xml-file-and-a-pdf-data-string)
        - [Create a merged PDF by an existing XML data string and a PDF data string](#create-a-merged-pdf-by-an-existing-xml-data-string-and-a-pdf-data-string)

License
-------

[](#license)

The code in this project is provided under the [MIT](https://opensource.org/licenses/MIT) license.

Overview
--------

[](#overview)

This library is an extension of the [horstoeko/zugferd](https://github.com/horstoeko/zugferd) library for the Laravel framework. It provides facades for communication with the underlying library [horstoeko/zugferd](https://github.com/horstoeko/zugferd).

Dependencies
------------

[](#dependencies)

This package makes use of

- [horstoeko/zugferd](https://github.com/horstoeko/zugferd)

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

[](#installation)

There is one recommended way to install `horstoeko/zugferd-laravel` via [Composer](https://getcomposer.org/):

- adding the dependency to your `composer.json` file:

```
  "require": {
      ..
      "horstoeko/zugferd-laravel":"^1",
      ..
  },
```

Usage
-----

[](#usage)

In general, you should read the [documentation](https://github.com/horstoeko/zugferd/blob/master/README.md) and [examples](https://github.com/horstoeko/zugferd/tree/master/examples) of the `horstoeko/zugferd` library before using this library.

This package provides a facade `ZugferdLaravel` which is used in the following examples.

Just add an use clause in the form of

```
use horstoeko\zugferdlaravel\Facades\ZugferdLaravel;
```

### Create a new Document Builder in the MINIMUM-Profile

[](#create-a-new-document-builder-in-the-minimum-profile)

```
$document = ZugferdLaravel::createDocumentInMinimumProfile();
```

### Create a new Document Builder in the BASIC-Profile

[](#create-a-new-document-builder-in-the-basic-profile)

```
$document = ZugferdLaravel::createDocumentInBasicProfile();
```

### Create a new Document Builder in the BASIC-WL-Profile

[](#create-a-new-document-builder-in-the-basic-wl-profile)

```
$document = ZugferdLaravel::createDocumentInBasicWlProfile();
```

### Create a new Document Builder in the EN16931-Profile (COMFORT-Profile)

[](#create-a-new-document-builder-in-the-en16931-profile-comfort-profile)

```
$document = ZugferdLaravel::createDocumentInEN16931Profile();
```

### Create a new Document Builder in the EXTENDED-Profile

[](#create-a-new-document-builder-in-the-extended-profile)

```
$document = ZugferdLaravel::createDocumentInExtendedProfile();
```

### Create a new Document Builder in the XRECHNUNG-Profile (Version 2.2)

[](#create-a-new-document-builder-in-the-xrechnung-profile-version-22)

```
$document = ZugferdLaravel::createDocumentInXRechnung22Profile();
```

### Create a new Document Builder in the XRECHNUNG-Profile (Version 2.3)

[](#create-a-new-document-builder-in-the-xrechnung-profile-version-23)

```
$document = ZugferdLaravel::createDocumentInXRechnung23Profile();
```

### Create a new Document Builder in the XRECHNUNG-Profile (Version 3.0)

[](#create-a-new-document-builder-in-the-xrechnung-profile-version-30)

```
$document = ZugferdLaravel::createDocumentInXRechnung30Profile();
```

### Create a Document Reader from an existing XML file

[](#create-a-document-reader-from-an-existing-xml-file)

```
$document = ZugferdLaravel::readXmlFromFile('/path/to/file.xml');
```

### Create a Document Reader from an XML string

[](#create-a-document-reader-from-an-xml-string)

```
$document = ZugferdLaravel::readXmlFromString('...');
```

### Create a Document Reader from an existing PDF file (which has an attached XML file)

[](#create-a-document-reader-from-an-existing-pdf-file-which-has-an-attached-xml-file)

```
$document = ZugferdLaravel::readXmlFromPdfFile('/path/to/file.pdf');
```

### Create a merged PDF (XML as attachment) by the output of a ZugferdDocumentBuilder

[](#create-a-merged-pdf-xml-as-attachment-by-the-output-of-a-zugferddocumentbuilder)

```
$document = ZugferdLaravel::createDocumentInEN16931Profile();

$document
    ->setDocumentInformation("471102", "380", \DateTime::createFromFormat("Ymd", "20180305"), "EUR")
    ->....;

$pdfDataOrFilename = '/path/to/file.pdf';
$mergedPdfFilename = '/path/to/merged.pdf';

ZugferdLaravel::buildMergedPdfByDocumentBuilder($document, $pdfDataOrFilename, $mergedPdfFilename);
```

### Create a merged PDF by an existing XML file and existing PDF file

[](#create-a-merged-pdf-by-an-existing-xml-file-and-existing-pdf-file)

```
$xmlDataOrFilename = '/path/to/file.xml';
$pdfDataOrFilename = '/path/to/file.pdf';
$mergedPdfFilename = '/path/to/merged.pdf';

ZugferdLaravel::buildMergedPdfByXmlDataOrXmlFilename($xmlDataOrFilename, $pdfDataOrFilename, $mergedPdfFilename);
```

### Create a merged PDF by an existing XML data string and existing PDF file

[](#create-a-merged-pdf-by-an-existing-xml-data-string-and-existing-pdf-file)

```
$xmlDataOrFilename = '
