CfdiUtils is distributed as a Composer package and requires PHP 8.0 or higher. The recommended installation path is through Composer, which handles dependency resolution, autoloading, and enforces the required PHP extension constraints automatically. If your project does not use Composer, a manual workaround is also described below.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.
Requirements
The following PHP extensions are required and must be enabled before installing:| Extension | Purpose |
|---|---|
ext-libxml | XML parsing foundation used across the library |
ext-dom | DOM document creation and manipulation |
ext-xsl | XSLT transformations needed to build the cadena de origen |
ext-simplexml | Simple XML reading for quick document access |
ext-mbstring | Multi-byte string handling for RFC and name fields |
ext-openssl | Certificate parsing and SHA-256 digital signing |
ext-iconv | Character set conversion for XML encoding |
ext-json | JSON encoding used in utilities and helpers |
| Extension / Package | Feature |
|---|---|
ext-bcmath | Precise decimal arithmetic for Pagos 2.0 complement totals |
ext-soap | Consume the SAT CFDI status web service |
genkgo/xsl | Alternative XSLT v2 processor via the Genkgo XSL library |
Install with Composer
Run the following command in your project root:- Download the latest stable
3.xrelease. - Verify your PHP version is
>=8.0. - Check that all required extensions are present.
- Install the two runtime dependencies:
eclipxe/xmlresourceretrieverandeclipxe/xmlschemavalidator.
Install without Composer
If your project does not use Composer, you can install CfdiUtils into a dedicated sub-directory and include only its generated autoloader:What’s Included
After installation the package is unpacked intovendor/eclipxe/cfdiutils/. The distribution package (what Composer downloads) contains:
| Path | Contents |
|---|---|
*.md | License and general project files |
src/ | All library source code (autoloaded via PSR-4 as CfdiUtils\) |
docs/ | Full Spanish-language documentation for the project |
build/ | Empty directory; a resources/ sub-directory is created here at runtime to cache XSD, XSLT, and CER files downloaded from the SAT |
build/resources/ path is the default local cache for SAT XML resources. It can be changed by configuring the XmlResolver object — see Configure SAT Resource Cache below.
Upgrading from 2.x
Version 3.x was released in March 2025 primarily to ensure compatibility with PHP 8.4. It also removes all previously deprecated code and updates internal dependencies. PHP 7.3 and 7.4 are no longer supported.PHP version support dropped: 7.3 and 7.4 removed
PHP version support dropped: 7.3 and 7.4 removed
Support for PHP 7.3 and 7.4 has been removed. Both versions were end-of-life at the time of the 3.x release (March 2025). The minimum supported PHP version is now 8.0.
XmlResourceRetriever namespace changed
XmlResourceRetriever namespace changed
The
eclipxe/xmlresourceretriever dependency was upgraded from 1.x to 2.x. The root namespace changed from XmlResourceRetriever\ to Eclipxe\XmlResourceRetriever\. Update any direct references in your code accordingly.PemPrivateKey: isOpened() and isPEM() removed
PemPrivateKey: isOpened() and isPEM() removed
On
CfdiUtils\PemPrivateKey\PemPrivateKey:isOpened(): boolis removed — useisOpen(): boolinstead.isPEM(string $text): boolis removed — use the following replacement:
ConsultaCfdiSat: constructor and method changes
ConsultaCfdiSat: constructor and method changes
The SAT CFDI status query component has breaking changes. Consider switching to the dedicated
phpcfdi/sat-estado-cfdi package instead.CfdiUtils\ConsultaCfdiSat\Config::DEFAULT_WSDL_URLconstant removed — useDEFAULT_SERVICE_URL . '?singleWsdl'.- The
$wsdlLocationparameter was removed from theConfigconstructor. - All parameters in the
StatusResponseconstructor are now required (none are optional). Config::getWsdlUrl()removed — usegetServiceUrl().Config::getWsdlLocation()andConfig::getLocalWsdlLocation()removed.- New method
WebService::requestExpression(string $expression)added for direct expression queries. - Support file
ConsultaCFDIServiceSAT.svc.xmlremoved.
CadenaOrigen: builder and locations classes renamed
CadenaOrigen: builder and locations classes renamed
CfdiUtils\CadenaOrigen\CadenaOrigenBuilderremoved — useCfdiUtils\CadenaOrigen\DOMBuilder.CfdiUtils\CadenaOrigen\CadenaOrigenLocationsremoved — useCfdiUtils\CadenaOrigen\CfdiDefaultLocations.CfdiUtils\CadenaOrigen\DefaultLocationsremoved — useCfdiUtils\CadenaOrigen\CfdiDefaultLocations.
CFDI 3.3: getCfdiRelacionados() parameter removed
CFDI 3.3: getCfdiRelacionados() parameter removed
getCfdiRelacionados() on the CFDI 3.3 creator helper no longer accepts parameters. Calling it with arguments will cause an error. Update any call sites to use the parameterless form.The multiCfdiRelacionado() method has also been standardized.NodeInterface: new methods and removed sub-interface
NodeInterface: new methods and removed sub-interface
Only relevant if you extended or implemented
CfdiUtils\Nodes\NodeInterface directly:CfdiUtils\Nodes\NodeInterface\NodeHasValueInterfaceremoved — its methods (value(),setValue()) are now part ofNodeInterfacedirectly.- New method
exists(string $attribute): booladded toNodeInterface. searchNode()return type is now explicitlynull|self(was previously undefined).
Other removed elements
Other removed elements
CfdiUtils\Cleaner\Cleaner::removeIncompleteSchemaLocation()removed.CfdiUtils\Cfdi::CFDI_NAMESPACEconstant removed — useCFDI_SPECS['3.3'].CfdiUtils\Retenciones\Retenciones::RET_NAMESPACEconstant removed — useRET_SPECS['1.0'].CfdiUtils\Certificado\SerialNumber::baseConvert()removed.CfdiUtils\Validate\Cfdi33\Xml\XmlFollowSchemaremoved — useCfdiUtils\Validate\Xml\XmlFollowSchema.CfdiUtils\Elements\Cfdi33\Helpers\SumasConceptosWriterremoved — useCfdiUtils\SumasConceptos\SumasConceptosWriter.CfdiUtils\Elements\Cfdi40\Helpers\SumasConceptosWriterremoved — useCfdiUtils\SumasConceptos\SumasConceptosWriter.CfdiUtils\Utils\Crp20277Fixerremoved — the class was non-functional and should not have been used.CfdiUtils\Nodes\NodeHasValueInterfaceremoved — methods are now inNodeInterface.
QuickReader: new helper methods added (non-breaking)
QuickReader: new helper methods added (non-breaking)
Two new methods were added to
QuickReader to make it easier to work with without relying on magic calls:getChildren(string $name = ''): QuickReader[]— returns all child elements, optionally filtered by name.getAttributes(): array<string, string>— returns all attributes as a name-to-value array.
Configure SAT Resource Cache
CfdiUtils downloads XSD schema files and XSLT stylesheets from the SAT the first time they are needed, then caches them locally so subsequent calls are fast and offline-capable. By default the cache is stored invendor/eclipxe/cfdiutils/build/resources/.
You can change the cache location by configuring an XmlResolver and passing it to the creator:
setLocalPath('') on the resolver: