# Quick start
Your first invoice
<?php
require_once 'vendor/autoload.php';
use PhpFacturae\Invoice;use PhpFacturae\Party;
$invoice = Invoice::create('FAC-001') ->series('A') ->date('2025-03-01') ->seller( Party::company('B12345678', 'My Company S.L.') ->address('C/ Mayor 10', '28013', 'Madrid', 'Madrid') ->email('info@mycompany.es') ) ->buyer( Party::person('12345678Z', 'Laura', 'Gómez', 'Ruiz') ->address('C/ Sol 3', '28012', 'Madrid', 'Madrid') ->email('laura@example.com') ) ->line('Logo design', price: 450.00, vat: 21) ->transferPayment( iban: 'ES91 2100 0418 4502 0005 1332', dueDate: '2025-03-31' ) ->export('invoice.xml');
echo "✓ Invoice generated: invoice.xml\n";Advanced tax scenarios
VAT + IRPF withholding:
$invoice->line( description: 'IT consulting', price: 500.00, vat: 21, irpf: 15);Canary Islands (IGIC):
$invoice->line('Product shipped to the Canary Islands', price: 100, igic: 7);Equivalence surcharge:
$invoice->line('Retail product', price: 100, vat: 21, surcharge: 5.2);Exempt line:
$invoice->exemptLine('Training course', price: 2000, reason: 'Exempt under Art. 20 LIVA');Multiple taxes per line
use PhpFacturae\Entities\TaxBreakdown;use PhpFacturae\Enums\Tax;
$invoice->customLine( description: 'Product with multiple taxes', price: 300.00, taxes: [ new TaxBreakdown(Tax::IGIC, 7), new TaxBreakdown(Tax::REIGIC, 0.5), ]);Split payments
use PhpFacturae\Enums\PaymentMethod;
$invoice->splitPayments( method: PaymentMethod::Transfer, installments: 3, firstDueDate: '2025-04-01', intervalDays: 30, iban: 'ES91 2100 0418 4502 0005 1332');Validation
use PhpFacturae\Exceptions\InvoiceValidationException;
try { $invoice->export('invoice.xml');} catch (InvoiceValidationException $e) { echo "Validation errors:\n"; foreach ($e->getErrors() as $error) { echo " - $error\n"; }}