A simple ZUGFeRD/XRechnung/Factur-X Library for Laravel
- ZUGFeRD/XRechnung/Factur-X for Laravel
- Table of Contents
- License
- Overview
- Dependencies
- Installation
- Usage
- 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-WL-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 XRECHNUNG-Profile (Version 2.2)
- Create a new Document Builder in the XRECHNUNG-Profile (Version 2.3)
- Create a new Document Builder in the XRECHNUNG-Profile (Version 3.0)
- Create a Document Reader from an existing XML file
- 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 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 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 data string and a PDF data string
The code in this project is provided under the MIT license.
This library is an extension of the horstoeko/zugferd library for the Laravel framework. It provides facades for communication with the underlying library horstoeko/zugferd.
This package makes use of
There is one recommended way to install horstoeko/zugferd-laravel
via Composer:
- adding the dependency to your
composer.json
file:
"require": {
..
"horstoeko/zugferd-laravel":"^1",
..
},
In general, you should read the documentation and 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;
$document = ZugferdLaravel::createDocumentInMinimumProfile();
$document = ZugferdLaravel::createDocumentInBasicProfile();
$document = ZugferdLaravel::createDocumentInBasicWlProfile();
$document = ZugferdLaravel::createDocumentInEN16931Profile();
$document = ZugferdLaravel::createDocumentInExtendedProfile();
$document = ZugferdLaravel::createDocumentInXRechnung22Profile();
$document = ZugferdLaravel::createDocumentInXRechnung23Profile();
$document = ZugferdLaravel::createDocumentInXRechnung30Profile();
$document = ZugferdLaravel::readXmlFromFile('/path/to/file.xml');
$document = ZugferdLaravel::readXmlFromString('<xml>...</xml>');
$document = ZugferdLaravel::readXmlFromPdfFile('/path/to/file.pdf');
$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);
$xmlDataOrFilename = '/path/to/file.xml';
$pdfDataOrFilename = '/path/to/file.pdf';
$mergedPdfFilename = '/path/to/merged.pdf';
ZugferdLaravel::buildMergedPdfByXmlDataOrXmlFilename($xmlDataOrFilename, $pdfDataOrFilename, $mergedPdfFilename);
$xmlDataOrFilename = '<?xml version="1.0" encoding="UTF-8"?><rsm:CrossIndustryInvoice.....';
$pdfDataOrFilename = '/path/to/file.pdf';
$mergedPdfFilename = '/path/to/merged.pdf';
ZugferdLaravel::buildMergedPdfByXmlDataOrXmlFilename($xmlDataOrFilename, $pdfDataOrFilename, $mergedPdfFilename);
$xmlDataOrFilename = '/path/to/file.xml';
$pdfDataOrFilename = '%PDF-1.5....';
$mergedPdfFilename = '/path/to/merged.pdf';
ZugferdLaravel::buildMergedPdfByXmlDataOrXmlFilename($xmlDataOrFilename, $pdfDataOrFilename, $mergedPdfFilename);
$xmlDataOrFilename = '<?xml version="1.0" encoding="UTF-8"?><rsm:CrossIndustryInvoice....';
$pdfDataOrFilename = '%PDF-1.5....';
$mergedPdfFilename = '/path/to/merged.pdf';
ZugferdLaravel::buildMergedPdfByXmlDataOrXmlFilename($xmlDataOrFilename, $pdfDataOrFilename, $mergedPdfFilename);