# Installation

Requirements

PHP FacturaE requires PHP 8.2 or higher.

Required PHP extensions:

  • ext-openssl — Required for XAdES-EPES digital signatures and certificate handling
  • ext-dom — Required for XML generation and manipulation

Install via Composer

composer require php-facturae/php-facturae

Verify the installation

<?php
require_once 'vendor/autoload.php';
use PhpFacturae\Invoice;
use PhpFacturae\Party;
$invoice = Invoice::create('TEST-001')
->seller(Party::company('B12345678', 'Test Company'))
->buyer(Party::company('B87654321', 'Client Company'))
->line('Test product', price: 100.00, vat: 21);
echo "✓ PHP FacturaE is correctly installed!\n";
echo "Invoice number: " . $invoice->getNumber() . "\n";

Autoloading

PHP FacturaE uses PSR-4 autoloading:

  • PhpFacturae\Invoice maps to src/Invoice.php
  • PhpFacturae\Party maps to src/Party.php
  • PhpFacturae\Entities\Line maps to src/Entities/Line.php

Development dependencies

composer install --dev

Includes PHPUnit 11.0+ and PHPStan 2.0+ (level 8).

# Run tests
vendor/bin/phpunit
# Run static analysis
vendor/bin/phpstan analyse src --level=8

Troubleshooting

“ext-openssl is missing” — Install php8.2-openssl (Ubuntu/Debian) or enable it in php.ini (Windows).

“ext-dom is missing” — Install php8.2-xml (Ubuntu/Debian).

“Class ‘PhpFacturae\Invoice’ not found” — Make sure you include vendor/autoload.php. Run composer dump-autoload if needed.

Optional: TSA time-stamping

For time-stamping authority (TSA) support, you will need ext-curl:

sudo apt-get install php8.2-curl