Download the PHP package vimatech/laravel-einvoicing without Composer

On this page you can find all versions of the php package vimatech/laravel-einvoicing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-einvoicing

Laravel E-Invoicing

Structured e-invoices for Laravel, generated natively

CI Latest Version on Packagist Total Downloads License

Generate structured e-invoices natively (Peppol BIS Billing 3.0 UBL and EN 16931 CII) for Laravel 11, 12 and 13, and dispatch them through pluggable networks (Peppol access points, French PDPs), with per-country routing.

Zero third-party runtime dependencies. Every document is built with PHP's own ext-dom; every network call uses Laravel's own HTTP client. No horstoeko/zugferd, no UBL libraries, no PDF libraries. This is a deliberate security & maintenance policy.

Features

Requirements

Installation

Publish the config (optional):

Quick start

1. Build a canonical invoice

The CanonicalInvoice is the only model you ever construct. It is format- and network-agnostic.

Document totals (line extension, tax exclusive/inclusive, payable) are derived from the lines and the VAT breakdown: you do not pass them in.

Precision and currency scale

Values are rendered at the precision they carry, and refused rather than rounded when a field cannot hold them:

Field Rendered as Refused when
Amounts (BT-106 to BT-117, BT-131) exactly 2 decimals the value has a third decimal (EN 16931 BR-DEC)
Unit price (BT-146) 2 to 6 decimals, trailing zeros trimmed the value has a seventh decimal
VAT rate (BT-119, BT-152) 2 to 4 decimals, trailing zeros trimmed the value has a fifth decimal

Floats built from exact decimals are accepted as those decimals: 0.1 + 0.2 renders as 0.30.

The derived totals and the arithmetic checks are rounded at two decimals by default. Pass amountDecimals, the ISO 4217 minor unit of the currency as you fixed it when issuing, to use another scale:

This governs the model, not the XML: a UBL or CII document still refuses an amount with a real third decimal, so a TND invoice of 1.235 cannot be emitted, while a JPY invoice renders its whole amounts as 1000.00.

2. Generate a UBL (Peppol BIS 3.0) document

A credit note is the same call with typeCode: CanonicalInvoice::TYPE_CREDIT_NOTE: the generator switches to the CreditNote root and CreditedQuantity automatically. Generate CII with Format::Cii.

Name the invoice a credit note corrects with precedingInvoiceReference (EN 16931 group BG-3):

It becomes cac:BillingReference/cac:InvoiceDocumentReference in UBL and ram:InvoiceReferencedDocument in CII. EN 16931 leaves the group optional, so the package does not require it, but a credit note that names no preceding invoice is rejected by the profiles that do, including the French PDP rules. The same field is valid on a 380 invoice, where it points at the partial or pre-payment invoices a final invoice completes.

If a mandatory field is missing or the arithmetic does not balance, generation throws InvalidInvoice, which carries the full list of violations:

Which rules run depends on what is being emitted. Format::Cii carries the plain EN 16931 guideline identifier and is validated against the core alone; Format::Ubl carries the Peppol BIS Billing 3.0 customization identifier and additionally enforces the Peppol rules: electronic addresses for both parties, and PEPPOL-EN16931-R003, which requires a buyer reference (BT-10) or a purchase order reference (BT-13). Both terms are optional in the core standard, so neither is required of a CII document.

Validate against a profile without generating anything:

Reach for ValidationProfile::PeppolBis on a CII document when you transmit it through Peppol, or to a CIUS that carries the same requirement: XRechnung enforces the buyer reference through BR-DE-15, and Chorus Pro requires a service code or an engagement number for the public entities whose directory entry demands one.

3. Send through a network

send() renders the document, routes it by the buyer's country, transmits it, and fires the lifecycle events:

Force a format or a specific network:

Resolve a network yourself:

Transmit the stored document

send() renders the invoice again before transmitting it. To transmit the exact file you stored when the invoice was issued, rebuild the GeneratedDocument from it and pass it to transmit():

fromStored() sets the MIME type, profile and file name generate() would have set, and refuses contents that are not a document of that format carrying that invoice number. transmit() routes with the CanonicalInvoice, refuses a document issued for another invoice number, and fires the same events as send(); EInvoiceGenerated is not fired, since nothing is generated.

send() and transmit() always fire EInvoiceDispatched. EInvoiceDelivered fires only for Delivered and Accepted, EInvoiceRejected only for Rejected and Failed. A queued submission, a document still in transit, or a status your status_map does not cover fires neither: poll fetchStatus() rather than treating the absence of a delivery as a refusal.

4. Receive inbound documents

Bodies arrive base64-encoded. A body that is absent, that is not valid base64, or that decodes to nothing raises NetworkException naming the offending message id, and the whole batch stops: the package will not hand your application a document it could not decode. If your partner returns unencoded bodies, extend the driver and override decodeInbound(); do not make it accept both, since the two cannot be told apart and the wrong guess silently yields a corrupt invoice.

Each InboundDocument carries a format. A format the partner declares that is a value of Format is used as declared. Otherwise it is read from the decoded contents, never assumed: a body starting with %PDF- is Format::FacturX; an XML document whose root is CrossIndustryInvoice in the CII namespace is Format::Cii; a root Invoice or CreditNote in its UBL namespace is Format::Ubl. A root with the right name but no namespace, or another namespace, is not taken for either. If you branch on $inbound->format, handle Format::FacturX.

A document whose format can be neither read from the declaration nor recognised in its contents is not returned. It is reported to your exception handler as Vimatech\EInvoicing\Exceptions\UnrecognisedInboundDocument (properties network, messageId, declaredFormat and raw, the provider's entry with its body still encoded), and the other documents of the batch are returned as usual. To keep or alert on them:

This applies to peppol, fr_pdp, and an AbstractHttpDriver subclass referenced by class, provided its constructor, if it defines one, accepts the fourth argument (an ExceptionHandler) and passes it to parent::__construct(). A driver left without an exception handler (built by hand, in an extend() factory, or by a constructor that drops the argument) throws the exception instead, which stops the batch.

Configuration

config/einvoicing.php declares the available networks, the country → network routing table, and the default format. Credentials come from the environment.

HTTP drivers read base_url, token, auth, timeout, headers, verify, paths and status_map. A setting that is present but cannot be read as the type it needs raises InvalidDriverConfig rather than being ignored, and environment strings such as "120" and "false" are understood: a value you set is either applied or reported, never dropped.

Adapting a built-in driver to your partner

PeppolDriver and FrPdpDriver speak a small, neutral REST shape. Point them at your access point / PDP by overriding paths and, where the vocabulary differs, status_map, no code change needed:

A missing or empty token is refused: an unauthenticated request to an accredited platform is rejected without a reason you can act on. When your partner authenticates another way (mutual TLS, a signed header), declare it, and configure no token:

Adding a country

Add a row to the routing map pointing at any configured network key:

Unmatched countries throw UnsupportedCountry unless a fallback network is set.

Per-tenant routing override

Register a resolver in a service provider to override routing per tenant or per invoice. Returning a network key wins over the static map; returning null defers to it. The router is a singleton, so the resolver lives for the whole process: under Octane, registering it inside a request leaks it to every later request on that worker. Resolve the tenant inside the closure, as below, rather than closing over one:

Adding a driver

Implement EInvoiceNetwork (or extend AbstractHttpDriver for a REST partner), keeping every vendor concept inside the driver:

Reference it by class in config (it is resolved from the container):

Or register a factory for a driver alias at runtime. extend() is keyed by the driver name, so the network entry must name that alias:

Testing with the FakeDriver

A dependency-free FakeDriver is shipped for your test suite. Swap any network for it and assert against what was sent, no HTTP, no credentials:

FakeDriver also supports pushInbound() for receive() flows, the inspection API (sent(), sentCount(), hasSent(), lastSent()) and the assert* helpers.

Conformance & testing notes

Run the suite:

Architecture

Contributing

Contributions are welcome.

Please ensure:

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our Security Policy for reporting vulnerabilities.

License

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

Credits

Built and maintained by Vimatech. Created by Adel Zemzemi, Laravel SaaS architect.


All versions of laravel-einvoicing with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-dom Version *
ext-mbstring Version *
illuminate/support Version ^11.0 || ^12.0 || ^13.0
illuminate/contracts Version ^11.0 || ^12.0 || ^13.0
illuminate/http Version ^11.0 || ^12.0 || ^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package vimatech/laravel-einvoicing contains the following files

Loading the files please wait ...