定制 tigamadou/emecef-laravel 二次开发

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

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

tigamadou/emecef-laravel

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.

tigamadou/emecef-laravel 适用场景与选型建议

tigamadou/emecef-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 tigamadou/emecef-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tigamadou/emecef-laravel 我们能提供哪些服务?
定制开发 / 二次开发

基于 tigamadou/emecef-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

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