Giter VIP home page Giter VIP logo

rechnungsmail.de's Introduction

Extract billing data from text according to rechnungsmail.de

Software License

This package provides an easy way to extract billing data from text according to rechnungsmail.de.

einfachArchiv is a German SaaS product to organize your documents in one place and meet all legal requirements. You'll find us on our website.

Requirements

PHP 7.0 and later.

Installation

You can install this package via Composer. Run the following command:

composer require einfacharchiv/rechnungsmail.de

Usage

Extracting billing data is easy.

$email = <<<EOE
Sehr geehrte Frau Mustermann, 

anbei erhalten Sie Rechnung-Nr. 4711 vom 20.11.2077. 
Die Rechnung ist im PDF-Format erstellt worden. Sollten 
Sie Fragen oder Probleme haben, stehen wir Ihnen 
jederzeit zur Verfügung. 

-- 
Mit freundlichen Grüßen,
Max Müller

Rechnungsdaten nach rechnungsmail.de:
Rechnungsnummer:     4711
Rechnungsdatum:      20.11.2077
Rechnungsbetrag:     119,00 EUR
Kundennummer:        123456
Nettobetrag 19%:     100,00 EUR
Umsatzsteuer 19%:    19,00 EUR
Absender-Name:       Max Müller GbR
Ihre Auftragsnummer: 4500006789
Vertragsnummer:      V-4711
EOE;

$rechnungsmail = new \einfachArchiv\Rechnungsmail\Rechnungsmail($email);

// Check if the email contains billing data according to rechnungsmail.de
if ($rechnungsmail->isValid()) {
    $rechnungsmail->getInvoiceId();
    $rechnungsmail->getInvoiceDate();
    $rechnungsmail->getInvoiceAmount(); // Returns an array
    $rechnungsmail->getCustomerId();
    $rechnungsmail->getNetAmount(); // Returns an array
    $rechnungsmail->getTax(); // Returns an array
    $rechnungsmail->getSenderName();
    $rechnungsmail->getOrderId();
    $rechnungsmail->getContractId();
}

If a field is not present or invalid, the method returns null.

The method ->getInvoiceAmount() returns an array like this one:

[
    'amount' => 119,
    'currency' => 'EUR',
];

The methods ->getNetAmount() and ->getTax() return arrays like this one:

[
    'amount' => 100,
    'currency' => 'EUR',
    'taxRate' => 19
];

All amounts are returned as floats.

The invoice date is, if present, a valid date and can be used like this:

$invoiceDate = $rechnungsmail->getInvoiceDate();

if ($invoiceDate) {
    \Carbon\Carbon::parse($invoiceDate)->toDateString();
}

Contributing

Contributions are welcome.

We accept contributions via Pull Requests on Github.

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, we'll try to address it as soon as possible.

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

Happy coding!

Credits

License

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

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.