Search by

akira / efatura

kidiatoliny

Laravel package for Cabo Verde e-Fatura fiscal data, configuration, and validation.

Package info

github.com/akira-io/laravel-efatura

pkg:composer/akira/efatura

Fund package maintenance!

kidiatoliny

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 1

dev-main 2026-10-17 11:22 UTC

This package is auto-updated.

Last update: 2026-10-17 11:22:51 UTC


README

Laravel Efatura

Packagist Version downloads tests license php

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

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:

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.