# PHP FacturaE

[ open source ] [ producción ] github →

Open-source PHP library to generate, sign and export FacturaE electronic invoices. Fluent API, XAdES-EPES signature, zero dependencies.

stack
PHP · FacturaE · XAdES-EPES · XML/XSD · OpenSSL
published

the problem

FacturaE is the official XML format required by the Spanish public administration (AEAT). Existing PHP libraries are mostly abandoned, lack XAdES-EPES with timestamping support, or drag heavy dependency trees and PHP 5 requirements.

PHP FacturaE fills the gap: a modern, typed library with zero external dependencies, capable of generating, validating and signing FacturaE 3.2.x invoices including complex scenarios — corrective invoices, discounts, Canary IGIC, FACe integration.

technical decisions

  • Zero external dependencies. Only stdlib PHP extensions (openssl, dom, libxml). Clean install, no dependency trees.
  • Fluent API. Invoice::create()->seller(...)->buyer(...)->lineItem(...) readable and IDE-friendly.
  • Built-in official XSD validation before signing — catch errors in dev, not in production when AEAT rejects the XML.
  • XAdES-EPES with optional TSA for time-stamping per AEAT requirements.
  • PHP 8.1+ with strict types — readonly properties, enums, match expressions.