https://github.com/horstoeko/zugferd-laravel
A simple ZUGFeRD/XRechnung/Factur-X Library for Laravel
https://github.com/horstoeko/zugferd-laravel
electronic-invoices electronic-invoicing factur-x laravel laravel-framework php php7 php8 xrechnung zugferd
Last synced: 3 months ago
JSON representation
A simple ZUGFeRD/XRechnung/Factur-X Library for Laravel
- Host: GitHub
- URL: https://github.com/horstoeko/zugferd-laravel
- Owner: horstoeko
- License: mit
- Created: 2023-08-22T13:08:34.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-22T20:04:02.000Z (6 months ago)
- Last Synced: 2024-12-10T09:39:53.724Z (5 months ago)
- Topics: electronic-invoices, electronic-invoicing, factur-x, laravel, laravel-framework, php, php7, php8, xrechnung, zugferd
- Language: PHP
- Homepage: https://github.com/horstoeko/zugferd-laravel
- Size: 63.5 KB
- Stars: 20
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# ZUGFeRD/XRechnung/Factur-X for Laravel
[](https://packagist.org/packages/horstoeko/zugferd-laravel) [](https://packagist.org/packages/horstoeko/zugferd-laravel) [](https://packagist.org/packages/horstoeko/zugferd-laravel) [](https://packagist.org/packages/horstoeko/zugferd) [](https://gitter.im/horstoeko/zugferd)
[](https://github.com/horstoeko/zugferd-laravel/actions/workflows/build.php73.ant.yml) [](https://github.com/horstoeko/zugferd-laravel/actions/workflows/build.php74.ant.yml) [](https://github.com/horstoeko/zugferd-laravel/actions/workflows/build.php80.ant.yml) [](https://github.com/horstoeko/zugferd-laravel/actions/workflows/build.php81.ant.yml)
A simple ZUGFeRD/XRechnung/Factur-X Library for Laravel
## 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
The code in this project is provided under the [MIT](https://opensource.org/licenses/MIT) license.
## 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
This package makes use of
- [horstoeko/zugferd](https://github.com/horstoeko/zugferd)
## Installation
There is one recommended way to install `horstoeko/zugferd-laravel` via [Composer](https://getcomposer.org/):
* adding the dependency to your ``composer.json`` file:
```js
"require": {
..
"horstoeko/zugferd-laravel":"^1",
..
},
```## 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
```php
use horstoeko\zugferdlaravel\Facades\ZugferdLaravel;
```### Create a new Document Builder in the MINIMUM-Profile
```php
$document = ZugferdLaravel::createDocumentInMinimumProfile();
```### Create a new Document Builder in the BASIC-Profile
```php
$document = ZugferdLaravel::createDocumentInBasicProfile();
```### Create a new Document Builder in the BASIC-WL-Profile
```php
$document = ZugferdLaravel::createDocumentInBasicWlProfile();
```### Create a new Document Builder in the EN16931-Profile (COMFORT-Profile)
```php
$document = ZugferdLaravel::createDocumentInEN16931Profile();
```### Create a new Document Builder in the EXTENDED-Profile
```php
$document = ZugferdLaravel::createDocumentInExtendedProfile();
```### Create a new Document Builder in the XRECHNUNG-Profile (Version 2.2)
```php
$document = ZugferdLaravel::createDocumentInXRechnung22Profile();
```### Create a new Document Builder in the XRECHNUNG-Profile (Version 2.3)
```php
$document = ZugferdLaravel::createDocumentInXRechnung23Profile();
```### Create a new Document Builder in the XRECHNUNG-Profile (Version 3.0)
```php
$document = ZugferdLaravel::createDocumentInXRechnung30Profile();
```### Create a Document Reader from an existing XML file
```php
$document = ZugferdLaravel::readXmlFromFile('/path/to/file.xml');
```### Create a Document Reader from an XML string
```php
$document = ZugferdLaravel::readXmlFromString('...');
```### Create a Document Reader from an existing PDF file (which has an attached XML file)
```php
$document = ZugferdLaravel::readXmlFromPdfFile('/path/to/file.pdf');
```### Create a merged PDF (XML as attachment) by the output of a ZugferdDocumentBuilder
```php
$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
```php
$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
```php
$xmlDataOrFilename = '