tigamadou/emecef-core-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

tigamadou/emecef-core-php

最新稳定版本:v0.0.2

Composer 安装命令:

composer require tigamadou/emecef-core-php

包简介

Framework-agnostic Core SDK for the Benin Republic e-MECeF (Electronic Tax Invoice) system

README 文档

README

Framework-agnostic Core SDK for the Benin Republic e-MECeF (Electronic Tax Invoice) system.

Part of the e-MECeF SDK ecosystem. This package contains all e-MECeF protocol logic; framework adapters (Laravel, Symfony, etc.) and CMS plugins depend on it and must not reimplement business rules.

Requirements

  • PHP ≥ 8.2

Installation

composer require tigamadou/emecef-core-php

Or from the monorepo (development):

cd php/packages/core/emecef-core
composer install

Quick Start

The Core does not read configuration. You inject base URL, JWT token, an HTTP client implementation, and a logger:

use Emecef\Core\Client;
use Emecef\Core\Contract\HttpClientInterface;
use Emecef\Core\Contract\LoggerInterface;

$client = new Client(
    baseUrl: 'https://sygmef.impots.bj/emcf/api/invoice',
    token: 'your-jwt-from-dgi',
    httpClient: $yourHttpClient,  // must implement HttpClientInterface
    logger: $yourLogger          // must implement LoggerInterface
);

For full configuration and usage, see the docs in this package:

Data objects (DTOs) and enums

The package models all request and response structures from the e-MECeF API v1.0 specification. For field-by-field descriptions and request/return shapes, see DTOs and API reference:

  • Enums: Emecef\Core\Enum\InvoiceType, AibGroupType, TaxGroupType, PaymentType
  • Request DTOs (build payloads, call toArray() or toJson()): Emecef\Core\Dto\Request\InvoiceRequestDataDto, ItemDto, ClientDto, OperatorDto, PaymentDto
  • Response DTOs (create from API array via fromArray()): Emecef\Core\Dto\Response\StatusResponseDto, PendingRequestDto, InvoiceResponseDataDto, SecurityElementsDto

You can use the client with raw JSON (array in/out) or with typed DTOs:

// Array-based (unchanged)
$status = $client->getStatus();           // array
$result = $client->submitInvoice($json); // array
$client->confirm($uid);                   // array
$client->cancel($uid);                   // array

// DTO-based (typed request/response)
$statusDto = $client->getStatusResponse();                    // StatusResponseDto
$requestDto = new InvoiceRequestDataDto(...);                // build request
$responseDto = $client->submitInvoiceRequest($requestDto);   // InvoiceResponseDataDto
$securityDto = $client->confirmResponse($uid);               // SecurityElementsDto
$cancelDto = $client->cancelResponse($uid);                  // SecurityElementsDto

Package Rules

  • Framework-agnostic: No Laravel, Symfony, or CMS dependencies.
  • No env access: Configuration is passed in by the caller.
  • Transport abstraction: HTTP via HttpClientInterface; logging via LoggerInterface.

Development

composer install
composer phpcs         # code style check (mandatory)
composer phpcbf       # code style fix (mandatory)
composer phpmd        # mess detector (mandatory)
composer test
composer phpstan
  • Code style: PHP_CodeSniffer (phpcs + phpcbf) mandatory; PSR-12.
  • Mess detection: PHPMD mandatory.
  • Tests: PHPUnit, unit tests only; coverage target ≥ 95%.
  • Static analysis: PHPStan (max level).

License

Proprietary. See repository root for governance.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2026-02-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固