Coder Social home page Coder Social logo

horstoeko / zugferd-laravel Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 0.0 40 KB

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

Home Page: https://github.com/horstoeko/zugferd-laravel

License: MIT License

PHP 100.00%
factur-x laravel laravel-framework xrechnung zugferd electronic-invoices electronic-invoicing php php7 php8

zugferd-laravel's Introduction

ZUGFeRD/XRechnung/Factur-X for Laravel

Latest Stable Version Total Downloads Latest Unstable Version License Gitter

CI (Ant, PHP 7.3) CI (Ant, PHP 7.4) CI (PHP 8.0) CI (PHP 8.1)

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

Table of Contents

License

The code in this project is provided under the MIT license.

Overview

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.

Dependencies

This package makes use of

Installation

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",
      ..
  },

Usage

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;

Create a new Document Builder in the MINIMUM-Profile

$document = ZugferdLaravel::createDocumentInMinimumProfile();

Create a new Document Builder in the BASIC-Profile

$document = ZugferdLaravel::createDocumentInBasicProfile();

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

$document = ZugferdLaravel::createDocumentInBasicWlProfile();

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

$document = ZugferdLaravel::createDocumentInEN16931Profile();

Create a new Document Builder in the EXTENDED-Profile

$document = ZugferdLaravel::createDocumentInExtendedProfile();

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

$document = ZugferdLaravel::createDocumentInXRechnung22Profile();

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

$document = ZugferdLaravel::createDocumentInXRechnung23Profile();

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

$document = ZugferdLaravel::createDocumentInXRechnung30Profile();

Create a Document Reader from an existing XML file

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

Create a Document Reader from an XML string

$document = ZugferdLaravel::readXmlFromString('<xml>...</xml>');

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

$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

$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

$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);

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

$xmlDataOrFilename = '/path/to/file.xml';
$pdfDataOrFilename = '%PDF-1.5....';
$mergedPdfFilename = '/path/to/merged.pdf';

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

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

$xmlDataOrFilename = '<?xml version="1.0" encoding="UTF-8"?><rsm:CrossIndustryInvoice....';
$pdfDataOrFilename = '%PDF-1.5....';
$mergedPdfFilename = '/path/to/merged.pdf';

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

zugferd-laravel's People

Contributors

horstoeko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.