nowo-tech / verifactu-bundle
Symfony bundle for Spanish Veri*Factu (RD 1007/2023) billing record compliance: SHA-256 hash chains, XML generation, QR codes, and AEAT submission hooks
Package info
github.com/nowo-tech/VerifactuBundle
Type:symfony-bundle
pkg:composer/nowo-tech/verifactu-bundle
Fund package maintenance!
Requires
- php: >=8.1 <8.6
- ext-curl: *
- ext-dom: *
- ext-libxml: *
- ext-openssl: *
- endroid/qr-code: ^5.0 || ^6.0
- robrichards/xmlseclibs: ^3.1
- symfony/config: ^6.0 || ^7.0 || ^8.0
- symfony/console: ^6.0 || ^7.0 || ^8.0
- symfony/dependency-injection: ^6.0 || ^7.0 || ^8.0
- symfony/event-dispatcher: ^6.0 || ^7.0 || ^8.0
- symfony/http-kernel: ^6.0 || ^7.0 || ^8.0
- symfony/translation: ^6.0 || ^7.0 || ^8.0
- symfony/twig-bridge: ^6.0 || ^7.0 || ^8.0
- symfony/yaml: ^6.0 || ^7.0 || ^8.0
- twig/twig: ^3.0
Requires (Dev)
- doctrine/doctrine-bundle: ^2.11
- doctrine/orm: ^2.14 || ^3.0
- friendsofphp/php-cs-fixer: ^3.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^10.0
- rector/rector: ^2.0
- symfony/framework-bundle: ^6.0 || ^7.0 || ^8.0
- symfony/twig-bundle: ^6.0 || ^7.0 || ^8.0
- symfony/var-exporter: ^7.4
Suggests
- doctrine/doctrine-bundle: Required for Doctrine entity mapping
- doctrine/orm: Required for persistent hash chain storage (hash_chain.storage: doctrine)
README
⭐ Found this useful? Give it a star on GitHub! It helps us maintain and improve the project.
Symfony bundle for Spanish Veri*Factu compliance (RD 1007/2023) — SHA-256 hash chains, billing record XML, AEAT QR codes, validation, and submission hooks for SIF-compatible invoicing systems.
Features
- ✅ Hash chain (SHA-256): AEAT-compliant fingerprint calculation and encadenamiento
- ✅ Billing record XML: Registro de facturación generation (Alta / Anulación)
- ✅ QR codes: ISO/IEC 18004 QR with AEAT verification URL and mandatory legend
- ✅ Business rules validation: NIF/CIF/NIE, dates, amounts, invoice types
- ✅ Symfony events: Before/after generation and AEAT submission hooks
- ✅ Console commands: Validate records and verify hashes from CLI
- ✅ Twig helpers:
verifactu_qr_data_uri,verifactu_qr_url,verifactu_legend - ✅ Pluggable storage:
HashChainRepositoryInterfacewith in-memory and Doctrine backends - ✅ AEAT SOAP client: mTLS submission to sandbox/production with client certificate
- ✅ XAdES signing: No-Veri*Factu modalidad with PKCS#12/PEM certificates
- ✅ XSD validation: Official AEAT schemas shipped with the bundle
- ✅ Nowo integration:
InvoiceDraft+InvoiceToBillingRecordMapperfor ERP adoption - ✅ Sandbox CLI:
nowo:verifactu:submit-sandboxsmoke-test command - ✅ VeriFactu and No-VeriFactu modes: Configuration-driven behaviour
- ✅ i18n: Validation messages in 7 locales (en, es, it, fr, pt, de, nl)
Installation
composer require nowo-tech/verifactu-bundle
Register the bundle in config/bundles.php:
<?php return [ // ... Nowo\VerifactuBundle\NowoVerifactuBundle::class => ['all' => true], ];
Usage
See docs/USAGE.md for the full API. Quick example:
use Nowo\VerifactuBundle\Model\BillingRecord; use Nowo\VerifactuBundle\Model\RecordType; use Nowo\VerifactuBundle\Service\BillingRecordProcessor; /** @var BillingRecordProcessor $processor */ $processor = $container->get('nowo_verifactu.service.billing_record_processor'); $result = $processor->process(new BillingRecord( RecordType::Alta, issuerNif: '89890001K', invoiceSeriesNumber: 'FAC-2026-001', issueDate: '09-07-2026', invoiceType: 'F1', totalTaxAmount: '21.00', totalAmount: '121.00', generatedAt: '2026-07-09T16:00:00+02:00', ), submitToAeat: true); if ([] === $result['errors']) { echo $result['record']->hash; echo $result['record']->xml; }
Documentation
- Installation
- Configuration
- Usage
- Contributing
- Changelog
- Upgrading
- Release process
- Security policy
- Engram (MCP memory)
- Spec-driven development
Additional documentation
Demo
Symfony 8 demo with FrankenPHP:
make -C demo/symfony8 up
# Open http://localhost:8010
Tests and coverage
- Tests: PHPUnit (PHP)
- PHP: ~98% (116 tests; target ~100% per REQ-TEST-003; minimum 80% enforced in CI)
- TS/JS: N/A
- Python: N/A
Exclusions documented in docs/SPEC-DRIVEN-DEVELOPMENT.md.
make up && make install && make test make test-coverage make release-check
License
This bundle is released under the MIT License.
Author
Created by Nowo.tech