Download the PHP package anglemx/sat-cfdi without Composer
On this page you can find all versions of the php package anglemx/sat-cfdi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download anglemx/sat-cfdi
More information about anglemx/sat-cfdi
Files in anglemx/sat-cfdi
Package sat-cfdi
Short Description Parse and validate CFDIs against SAT México
License MIT
Homepage https://github.com/Angle/sat-cfdi
Rated 5.00 based on 1 reviews
Informations about the package sat-cfdi
SAT CFDI
A pure PHP library to simplify the handling and processing of CFDIs. Creates new CFDIs and parses and validates existing CFDI files.
A CFDI is a "Comprobante Fiscal Digital por Internet" of Mexico's SAT "Servicio de Administración Tributaria" (Tax Administration Service).
Features
- Parse XML representation of CFDIs
- Write XML files from a CFDI
- Validate cryptographic signatures
- Validate CFDI status online
Installation
Requires PHP 7.2+ and Composer.
Usage
For more implementation examples, check the Test files.
Dependencies
In order to make this library as robust as possible, we're using many libraries that are included by default on most environments.
- Implements XSD schema files to validate XML. (
ext-dom
,ext-libxml
) - Implements XSLT stylesheets to generate the Original Chain Sequence for signature validations. (
ext-xsl
) - Implements OpenSSL to operate and verify X.509 Certificates. (
ext-openssl
)
Translations
This library is written in english to maintain code consistency. However, some keywords are very specific to this domain.
Español | English |
---|---|
Comprobante | Invoice |
Relacionados | Related |
Emisor | Issuer |
Concepto | Item |
Impuesto | Tax |
Impuestos Trasladados | Transferred Tax |
Impuestos Retenidos | Retained Tax |
Información Aduanera | Customs Information |
Predial | Property Tax |
pending..
Resources
This library bundles some resources to simplify the installation process on production servers, and to allow for offline processing. All of these files are published by SAT and are made available completely free through SAT's official website.
Document | Date | URL |
---|---|---|
Standard (pdf) | 2017-07-28 | http://omawww.sat.gob.mx/tramitesyservicios/Paginas/documentos/cfdv33.pdf |
Schema (xsd) | 2017-07-28 | http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv33.xsd |
Original Chain Sequence (xslt) | 2021-12-01 | http://www.sat.gob.mx/sitio_internet/cfd/3/cadenaoriginal_3_3/cadenaoriginal_3_3.xslt |
Data Catalog (xsd) | 2020-12-29 | http://www.sat.gob.mx/sitio_internet/cfd/catalogos/catCFDI.xsd |
Data Types & Patterns (xsd) | 2017-12-14 | http://www.sat.gob.mx/sitio_internet/cfd/tipoDatos/tdCFDI/tdCFDI.xsd |
Fiscal Digital Signature, Schema v1.1 (xsd) | 2017-04-12 | http://www.sat.gob.mx/sitio_internet/cfd/timbrefiscaldigital/TimbreFiscalDigitalv11.xsd |
Fiscal Digital Signature, Original Chain Sequence (xslt) | 2017-05-29 | http://www.sat.gob.mx/sitio_internet/cfd/timbrefiscaldigital/cadenaoriginal_TFD_1_1.xslt |
Error Catalog (xls) | 2017-04-12 | http://omawww.sat.gob.mx/tramitesyservicios/Paginas/documentos/MatrizDeErrores_CFDI_v33.xls |
This list is not complete, but any reference to the complementary XSD and XSLT resources are included in the root definition schemas.
Certificates
We've bundled the production root X.509 Certificates (CA) in a convenient PEM file. If you'd prefer, you can download them from the official website and install those files locally: http://omawww.sat.gob.mx/tramitesyservicios/Paginas/certificado_sello_digital.htm
SAT publishes a list of all the certificates for every single registered and active taxpayer. You can consult any specific certificate with SAT's official tool "Recuperación de Certificados".
You can use that system to look up all of SAT's certificates by searching their RFC: SAT970701NN3
References
The official publication regarding CFDI is called "Anexo 20" and we are currently on CFDI version 3.3. View online.
Web Services
This employs some public web services to validate the status of CFDI.
pending..
Validations
See tests/ValidatorTest.php
for a sample implementation of the Validation Steps
- STEP 1: Parse XML into an Invoice
- STEP 2: Validate properties
- STEP 3: Validate CFDI signature
- STEP 4: Validate Fiscal Stamp (TFD)
- STEP 5: Validate CFDI's UUID against SAT
Testing
To run tests with PHPUnit, simply install the dev dependencies
Create a /test-data/
directory in this library's root path, and place all the XML files inside that you would like to test.
Finally, run the tests:
TO DO
- Validate properties when parsing
- Validate basic business rules
- Implement cache for X.509 Certificates
- Check for Certificate Revocation status before validating
- Implement cache for XSLT 2.0 transpilation
- Documentation and more samples
TO FIX
- Duplicated Namespace declarations on
CFDI::toXML()
when we have any child (even if not on the root node) with a different namespace than the default for the Document. We should clean this up when pretty printing our XMLs. - Replace all instances of
Node::NODE_NS_NAME
withNode::NODE_NS_URI_NAME
insidesetChildrenFromDOMNodes()
. SeeCFDI40\Complements
for reference.
Other notes
All versions of sat-cfdi with dependencies
ext-json Version *
ext-libxml Version *
ext-simplexml Version *
ext-dom Version *
ext-openssl Version *
ext-curl Version *
ext-xsl Version *
ext-intl Version *
anglemx/mexico-rfc Version ^1.0
genkgo/xsl Version ^1.0
fgrosse/phpasn1 Version ^2.1