pixan / cfdi
CFDi Module for Pixan APPS
Installs: 18
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Language:XSLT
This package is not auto-updated.
Last update: 2025-01-05 07:34:45 UTC
README
CFDI is a package that provides electronic invoicing capabilities through different PAC providers in Mexico for Laravel applications.
Installation
To install this package using composer:
composer require pixan/cfdi
Configuration
Add the service provider to the providers
array in app.php:
Pixan\Cfdi\CfdiServiceProvider::class,
Publish the configuration file, make sure you select Pixan\Cfdi\CfdiServiceProvider from the provided menu:
php artisan vendor:publish
Set the configuration parameters in the newly created configuration file:
config/cfdi.php
Usage
Generate an XML seal
To generate the seal of a previously formed XML file, create an array containing a valid CFDi certificate and its key file in PEM format. Calling the seal
method on the cfdi instance will return a valid seal string for the provided XML document:
$config = [ 'certificate' => $certificateFileContents, 'pem' => $pemFileContents ]; $cfdi = new Cfdi($config); $seal = $cfdi->seal($xml);
Stamp an XML
Calling the stamp
method on the cfdi instance will return a valid xml that has been stamped by the requested PAC service and configured environment. *Make sure that the proper configuration was provided when constructing the cfdi instance.
$config = [ 'certificate' => $certificateFileContents, 'pem' => $pemFileContents ]; $cfdi = new Cfdi($config); $seal = $cfdi->stamp($xml);
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.