Skip to main content

PHP FacturaE

Generate, validate and sign Spanish FacturaE electronic invoices with a fluent, type-safe PHP API

Quick Example

Create and sign a complete FacturaE invoice with just a few lines of code:
use PhpFacturae\Invoice;
use PhpFacturae\Party;
use PhpFacturae\Signer;

Invoice::create('FAC-001')
    ->series('A')
    ->date('2025-03-01')
    ->seller(Party::company('B12345678', 'Mi Empresa S.L.')
        ->address('C/ Mayor 10', '28013', 'Madrid', 'Madrid'))
    ->buyer(Party::person('12345678Z', 'Laura', 'Gómez', 'Ruiz')
        ->address('C/ Sol 3', '28012', 'Madrid', 'Madrid'))
    ->line('Diseño logotipo', price: 450.00, vat: 21)
    ->transferPayment(iban: 'ES91 2100 0418 4502 0005 1332', dueDate: '2025-03-31')
    ->sign(Signer::pfx('certificado.pfx', 'password'))
    ->export('factura.xsig');

Key Features

Fluent API

Type-safe enums and fluent builders eliminate arrays and magic strings

XAdES-EPES Signing

Digital signatures with optional TSA timestamping included

Comprehensive Tax Support

29 tax types including VAT, IRPF, IGIC, and surcharges

Schema Validation

Validates against official FacturaE 3.2.x XSD schemas

Zero Dependencies

Only standard PHP extensions required - no external packages

FACe Ready

Full support for Spanish public administration requirements

Get Started

Installation

Install via Composer and configure extensions

Quickstart

Create your first invoice in minutes

API Reference

Explore the complete API documentation

Core Concepts

Invoice Creation

Learn the fluent API for building invoices

Parties & Addresses

Define sellers, buyers, and administrative centers

Lines & Taxes

Configure invoice lines with multiple tax types

Payment Methods

Set up payments with 19 available methods

Why PHP FacturaE?

Modern alternative to legacy libraries — PHP FacturaE provides a type-safe, fluent API as a modern alternative to array-based configuration, with support for all FacturaE 3.2.x versions.
  • ~0.2 ms per simple invoice, ~22 ms for 100 invoices
  • 29 tax types · 19 payment methods · 36 units of measure
  • 22 correction reasons for rectificative invoices
  • PKCS#12 and PEM signature support with TSA timestamping

Build docs developers (and LLMs) love