定制 tigamadou/emecef-laravel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tigamadou/emecef-laravel

最新稳定版本:v0.0.2

Composer 安装命令:

composer require tigamadou/emecef-laravel

包简介

Laravel adapter for the e-MECeF (Electronic Tax Invoice) SDK – Benin Republic

README 文档

README

Laravel adapter for the Benin Republic e-MECeF (Electronic Tax Invoice) SDK. It wires emecef-core-php into Laravel via config, a facade, and Laravel’s HTTP and logging.

Part of the e-MECeF SDK ecosystem.

Requirements

Installation

composer require tigamadou/emecef-laravel

The package auto-registers its service provider and the Emecef facade (Laravel 11+ package discovery). For older Laravel, add the provider and alias in config/app.php if needed.

Configuration

  1. Publish the config file:

    php artisan vendor:publish --tag=emecef-config
  2. Store token, ifu, nim, and environment in the emecef_config table (see migrations). Config file is for Laravel-specific options only (e.g. log_channel).

  3. Publish and run migrations to create invoice and config tables:

    php artisan vendor:publish --tag=emecef-migrations
    php artisan migrate

    Models: Emecef\Laravel\Models\EmecefConfig, EmecefInvoice, EmecefInvoiceItem, EmecefInvoicePayment

  4. Optionally set log_channel for e-MECeF logs.

  5. (Optional) Publish views to customize the web interface:

    php artisan vendor:publish --tag=emecef-views

    Views are copied to resources/views/vendor/emecef.

See docs/configuration.md for the full config reference.

Web interface

The package includes a web interface for all e-MECeF actions. After migrations and config, visit /{prefix}/ (default: /emecef/):

Route Action
GET /emecef/ Dashboard (API status, recent invoices)
GET /emecef/invoices List invoices
GET /emecef/invoices/create Create invoice form
GET /emecef/invoices/{id} View invoice (confirm/cancel if pending)
GET /emecef/config View configuration
GET /emecef/config/edit Create or edit configuration (single row)

Configure route_prefix and route_middleware in config/emecef.php. See docs/configuration.md.

Quick start

Use the facade or inject Emecef\Core\Client:

use Emecef\Laravel\Facades\Emecef;

$status = Emecef::getStatusResponse();
use Emecef\Core\Client;

public function __construct(private readonly Client $emecef) {}
// $this->emecef->getStatusResponse(), submitInvoiceRequest(), confirmResponse(), cancelResponse(), etc.

All operations and DTOs are the same as in the core package. Example: submit an invoice and confirm:

use Emecef\Core\Dto\Request\InvoiceRequestDataDto;
use Emecef\Core\Dto\Request\ItemDto;
use Emecef\Core\Dto\Request\OperatorDto;
use Emecef\Core\Enum\InvoiceType;
use Emecef\Core\Enum\TaxGroupType;
use Emecef\Laravel\Facades\Emecef;

$request = new InvoiceRequestDataDto(
    ifu: '9999900000001',
    type: InvoiceType::FV,
    items: [
        new ItemDto('Article A', 1000, 2.0, TaxGroupType::A),
    ],
    operator: new OperatorDto('Opérateur 1')
);
$response = Emecef::submitInvoiceRequest($request);
if ($response->uid !== null) {
    $security = Emecef::confirmResponse($response->uid);
    // $security->qrCode, $security->codeMECeFDGI for the printed invoice
}

See docs/examples.md for more examples and error handling.

Documentation

Document Description
Overview What the package does and does not do, dependencies
Configuration Config file, routes, views, and how the client is built
Examples Facade, dependency injection, web interface, submit/confirm/cancel, errors
Schema Full database schema with API field mapping and descriptions
Core: DTOs and API All enums, request/response DTOs, and API operations

What this package provides

  • Config: config/emecef.php with log channel, route prefix, and route middleware.
  • Bindings: HttpClientInterface → Laravel HTTP client, LoggerInterface → Laravel Log (optional channel), Client as singleton.
  • Facade: Emecef\Laravel\Facades\EmecefEmecef\Core\Client.
  • Web interface: Dashboard, invoice list/create/show, config management. Views are publishable (emecef-views).
  • Routes: Prefixed by route_prefix (default emecef), protected by route_middleware (default web).

Business logic, DTOs, and API contract live in emecef-core-php; this adapter only integrates them with Laravel.

Development

composer install
composer phpcs
composer phpcbf
composer phpmd
composer test
composer phpstan
  • Code style: PHP_CodeSniffer (PSR-12).
  • Mess detection: PHPMD.
  • Tests: PHPUnit (Orchestra Testbench).
  • Static analysis: PHPStan.

License

Proprietary. See repository root for governance.

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2026-03-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固