Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Eseperio/verifactu-php/llms.txt
Use this file to discover all available pages before exploring further.
System requirements
Before installing, confirm your environment meets these requirements:| Requirement | Minimum version |
|---|---|
| PHP | 8.1 or higher |
| Composer | 2.x recommended |
ext-soap | any (bundled with PHP) |
ext-libxml | any (bundled with PHP) |
ext-openssl | any (bundled with PHP) |
ext-dom | any (bundled with PHP) |
soap, libxml, openssl, and dom listed. If any are missing, enable them in your php.ini or install the corresponding system package.
On Debian/Ubuntu systems you can install missing extensions with:
sudo apt-get install php8.1-soap php8.1-xml. The dom and libxml extensions are usually bundled with php-xml. On macOS with Homebrew, use brew install php — all four extensions are enabled by default.Installation steps
bacon/bacon-qr-code ^3 — QR code generationrobrichards/xmlseclibs ^3.0 — XAdES XML digital signaturevlucas/phpdotenv ^5.5 — .env file support for certificate configurationAll classes are available immediately after including the autoloader — no service container or manual registration needed.
AEAT requires a valid PKCS#12 digital certificate (
.pfx or .p12) to sign and submit invoices. Place it in a secure location outside your web root:/var/certs/aeat-certificate.p12 ← recommended
/var/www/html/certs/ ← NOT recommended (publicly accessible)
Verifactu::TYPE_CERTIFICATE — personal or company certificateVerifactu::TYPE_SEAL — AEAT seal certificate (sello)For development and CI environments, the library supports loading certificate paths from a
.env file using vlucas/phpdotenv. Copy the example:# Path to your certificate file
VERIFACTU_CERT_PATH=/path/to/your/certificate.p12
# Password for your certificate
VERIFACTU_CERT_PASSWORD=your_certificate_password
# Certificate type: 'certificate' or 'seal'
VERIFACTU_CERT_TYPE=certificate
# Environment: 'production' or 'sandbox'
VERIFACTU_ENVIRONMENT=sandbox
Always add
.env to your .gitignore. Never commit certificate paths or passwords to version control.<?php
require_once __DIR__ . '/vendor/autoload.php';
use eseperio\verifactu\Verifactu;
use eseperio\verifactu\models\InvoiceSubmission;
use eseperio\verifactu\models\enums\InvoiceType;
// Confirm the facade constant is accessible
echo Verifactu::ENVIRONMENT_SANDBOX . PHP_EOL; // "sandbox"
echo Verifactu::ENVIRONMENT_PRODUCTION . PHP_EOL; // "production"
// Confirm enums are available
echo InvoiceType::STANDARD->value . PHP_EOL; // "F1"
// Confirm model instantiation works
$invoice = new InvoiceSubmission();
echo get_class($invoice) . PHP_EOL; // "eseperio\verifactu\models\InvoiceSubmission"
echo "Installation OK" . PHP_EOL;
Docker setup
ADockerfile is included in the repository for containerised environments. To use it:
docker-compose.yml sets up a complete development environment with all required PHP extensions pre-installed.
Running the test suite
The library ships with a comprehensive test suite using PHPUnit 10:Integration tests (
composer test-sandbox) connect to AEAT’s homologation environment and require a valid certificate configured in .env. If .env is absent, Composer will create one from .env.example and tests that need a certificate will be skipped automatically.Installed directory structure
After installation, the library is atvendor/eseperio/verifactu-php/src/:
Next steps
Quickstart
Submit your first invoice to the AEAT sandbox in under 10 minutes
Introduction
Learn what Verifactu is and what this library covers