CfdiUtils provides everything you need to work with Mexican Comprobantes Fiscales Digitales por Internet (CFDI) in PHP. Whether you’re generating new invoices, reading existing ones, or validating their compliance against SAT rules, this library covers the full lifecycle of CFDI 3.2, 3.3, and 4.0.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/eclipxe13/CfdiUtils/llms.txt
Use this file to discover all available pages before exploring further.
Quickstart
Create and validate your first CFDI 4.0 in minutes with a working PHP example.
Installation
Install via Composer and review PHP extension requirements.
Reading CFDI
Parse CFDI 3.2, 3.3, and 4.0 documents into navigable node structures.
Creating CFDI
Build CFDI 4.0 documents using the fluent creator API with full complement support.
Validating CFDI
Validate CFDI against XSD schemas, Sello, and 80+ SAT business rules.
Core Components
Explore the building blocks: Nodes, Certificado, XmlResolver, and more.
What CfdiUtils Does
CfdiUtils is a PHP SDK library published on Packagist under the MIT license. It is designed for PHP 8.0+ and covers the complete CFDI workflow:Install with Composer
Add the library to your project in one command — it handles PHP extension requirements automatically.
Read existing CFDI
Load any CFDI 3.2, 3.3, or 4.0 document and navigate its structure using the
Cfdi class or the fast QuickReader API.Create new CFDI
Use
CfdiCreator40 (or CfdiCreator33 for legacy) to build, sign, and export valid CFDI XML with support for Nómina, Carta Porte, Pagos 2.0, and more.Key Features
CFDI Creation
Build CFDI 4.0 and 3.3 using a friendly node-based API. Add Emisor, Receptor, Conceptos, and impuestos without writing raw XML.
SAT Validation
80+ validators covering XSD schemas, Sello verification, Timbre Fiscal Digital, decimal precision, and Pagos complement rules.
Quick Reader
Case-insensitive, namespace-agnostic access to CFDI attributes and nodes — perfect for exporting to JSON or PDF templates.
SAT Status Query
Query the SAT WebService for real-time CFDI status — Estado, EsCancelable, EstatusCancelacion, and EFOS — without WSDL.
Local SAT Resources
Cache XSD, XSLT, and CER files from SAT locally so validation and Cadena de Origen work offline and fast.
Certificate Handling
Load CER/PEM certificate files, extract RFC and serial number, verify signatures, and match private keys.
Supported CFDI Versions
| Feature | CFDI 3.2 | CFDI 3.3 | CFDI 4.0 |
|---|---|---|---|
| Reading | ✅ | ✅ | ✅ |
| Validation | — | ✅ | ✅ |
| Creation | — | ✅ (legacy) | ✅ |
| Retenciones | — | ✅ | ✅ |
CFDI 3.3 creation is maintained for compatibility but the SAT has suspended its use. New integrations should target CFDI 4.0. CFDI 3.3 creation classes will be removed in a future major version.
PHP Compatibility
CfdiUtils requires PHP 8.0 or higher and the following extensions:libxml, dom, xsl, simplexml, mbstring, openssl, iconv, and json. Optional extensions bcmath (for Pagos 2.0) and soap (for SAT status queries) unlock additional features.
See the Installation guide for the full requirements list and Composer setup.