Integration & document processing

CFDI 4.0 Generator.

A focused Laravel technical test that converts structured JSON into CFDI 4.0 Ingreso XML and validates it locally.

Source on GitHub

Context & scope

Generate a CFDI 4.0 Ingreso document from structured invoice data without treating a specification-heavy task as a string-formatting exercise. It supports one IVA traslado per concepto; PAC integration, timbrado, real certificates, signatures, APIs, and a user interface are deliberately outside its scope.

Approach

An Artisan command reads JSON, applies input, SAT catalogue, and filling-guide checks, calculates amounts, builds XML with DOMDocument, writes the output, and validates it locally.

Key decisions

Amounts stay as decimal strings and use bcmath rather than PHP floats. Validation is layered: input and catalogue gates, local SAT XSD validation, then advisory structural checks.

System design

CFDI command reads JSON, validates and calculates it, then produces and validates XML.

Result

The command writes a tracked XML deliverable and reports validation failures with a non-zero exit status. It is a public demonstration, not an invoicing system.

Technologies

Laravel PHP Docker
Back to projects →