akira / efatura
Laravel package for Cabo Verde e-Fatura fiscal data, configuration, and validation.
Fund package maintenance!
Requires
- php: ^8.5
- ext-curl: *
- ext-dom: *
- ext-libxml: *
- ext-openssl: *
- ext-zip: *
- brick/money: ^0.11.0
- guzzlehttp/guzzle: ^7.15.2 || ^8.2
- laravel/framework: ^13.0
- psr/clock: ^1.0
- spatie/laravel-data: ^4.19
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- bacon/bacon-qr-code: ^3.1
- brianium/paratest: !=7.26.1
- dompdf/dompdf: ^3.1
- dompdf/php-font-lib: ^1.0.2
- dompdf/php-svg-lib: ^1.0.2
- driftingly/rector-laravel: ^2.3
- fakerphp/faker: ^1.24
- larastan/larastan: ^3.10
- laravel/pail: ^1.2
- laravel/pint: ^1.32
- mockery/mockery: ^1.6
- nunomaduro/collision: ^8.9.5
- orchestra/testbench: ^11.0.0
- peckphp/peck: ^0.3.0
- pestphp/pest: ^5.0
- pestphp/pest-plugin-arch: ^5.0
- pestphp/pest-plugin-browser: ^5.0
- pestphp/pest-plugin-laravel: ^5.0
- pestphp/pest-plugin-type-coverage: ^5.0
- phpoffice/phpspreadsheet: ^5.10
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- rector/rector: ^2.4
- roave/security-advisories: dev-latest
- robrichards/xmlseclibs: ^4.0
Suggests
- bacon/bacon-qr-code: Required to draw the DFA QR code as SVG, without gd or imagick (^3.1).
- dompdf/dompdf: Required to render the Documento Fiscal Auxiliar (DFA) as a PDF (^3.1).
Provides
None
Conflicts
- bacon/bacon-qr-code: <3.1
- dompdf/dompdf: <3.1
Replaces
None
This package is auto-updated.
Last update: 2026-10-17 11:22:51 UTC
README
Laravel package for Cabo Verde e-Fatura fiscal data, configuration, and validation.
Install
composer require akira/efatura
{
"require": {
"akira/efatura": "^1.0"
}
}
Publish the package configuration and the sequence migration, and prepare the required environment keys:
php artisan efatura:install php artisan migrate
Run without options in a terminal, the command asks before adding each missing
EFATURA_* key to .env; with --no-interaction it leaves .env alone, and
--write-env appends the keys without asking. See
installation for the requirements and the optional
DFA renderers, configuration for every key, and
console commands for every option and exit code.
Quick Start
<?php declare(strict_types=1); use Akira\Efatura\Data\LineItemData; use Akira\Efatura\Data\PartyData; use Akira\Efatura\Data\TotalsData; use Akira\Efatura\Enums\DocumentType; use Akira\Efatura\Facades\Efatura; $emitter = PartyData::from([ 'taxId' => ['value' => '100200300', 'countryCode' => 'CV'], 'name' => 'Example emitter', 'address' => [ 'countryCode' => 'CV', 'addressDetail' => 'Praia office', 'addressCode' => 'CV111111111011110101', ], 'contacts' => ['email' => 'billing@example.cv', 'telephone' => '2600000'], ]); $document = Efatura::invoice() ->type(DocumentType::Invoice) ->emitter($emitter, ledCode: 1) ->receiver(PartyData::from([ 'taxId' => ['value' => '900800700', 'countryCode' => 'CV'], 'name' => 'Example receiver', ])) ->line(LineItemData::from([ 'quantity' => ['value' => '1', 'unitCode' => 'C62'], 'item' => ['description' => 'Service', 'emitterIdentification' => 'SERVICE-1'], 'price' => '100', 'priceExtension' => '100', 'netTotal' => '100', 'taxes' => [['taxTypeCode' => 'IVA', 'taxPercentage' => '15']], ])) ->totals(TotalsData::from([ 'priceExtensionTotalAmount' => '100', 'netTotalAmount' => '100', 'taxTotalAmount' => '15', 'payableAmount' => '115', ])) ->build();
The example lives in docs/examples/quick-start.php. build() returns an
ElectronicInvoiceData; it does not issue the document or allocate a sequence number.
Replace the example identities, address and LED with your registered fiscal data.
The builder snapshots the package clock (Atlantic/Cape_Verde) when created; use
issuedAt(CarbonInterface $dateTime) (converted to Cabo Verde time) or header(DocumentHeaderData $header) for
explicit dates. Decimal strings avoid float rounding. A configured complete emitter
can replace the explicit emitter() call. See builders and configuration
and the migration guide. Payload keys keep the official XML names
(serie, taxTypeCode, lineTypeCode); the Data properties that read them are
named after their concept ($header->series, $tax->taxType, $line->lineType),
as listed in the renamed symbols table.
To issue it, check the installation once and send the document through the configured driver (the local middleware by default):
resolve(CheckReadinessAction::class)->handle()->ready(); $issued = resolve(IssueDocumentAction::class)->handle($document); $issued->authorized();
IssueDocumentAction numbers, signs, packages and submits the document and
dispatches Laravel events on the way. An ambiguous answer throws
transport.outcome_unknown: reconcile it by IUD before anything else. See
issuance, transport and
readiness.
Documentation
- Documentation index
- Installation
- Configuration
- Fiscal domain
- Builders
- Identifiers, XML and schema validation
- Document numbers and sequences
- Signing
- Packaging
- Transport
- Issuance
- Readiness
- Currency conversion
- Documento Fiscal Auxiliar (DFA)
- Artifact storage
- Console commands
- Diagnostics routes
- Troubleshooting
- Compliance with Manual v11
- Migration guide
- Configuration source: config/efatura.php
- API reference: source API
Testing
composer test
Changelog
See CHANGELOG.md for what has changed recently. Releases use conventional commits, and git-cliff generates the changelog when a version tag is pushed.
Contributing
See CONTRIBUTING.md for contribution details.
Security
Review SECURITY.md to report security vulnerabilities.
Credits
License
Dual-licensed under either of the following, at your option:
- MIT License (LICENSE-MIT or https://opensource.org/licenses/MIT)
- Apache License 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual-licensed as above, without extra terms or conditions.