PHPackages                             tigamadou/emecef-core-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. tigamadou/emecef-core-php

ActiveLibrary

tigamadou/emecef-core-php
=========================

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

v0.0.2(2mo ago)081proprietaryPHPPHP &gt;=8.2

Since Feb 11Pushed 2mo agoCompare

[ Source](https://github.com/tigamadou/emecef-core-php)[ Packagist](https://packagist.org/packages/tigamadou/emecef-core-php)[ RSS](/packages/tigamadou-emecef-core-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (3)Used By (1)

emecef-core
===========

[](#emecef-core)

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

Part of the [e-MECeF SDK ecosystem](https://github.com/your-org/emecef). 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
------------

[](#requirements)

- PHP ≥ 8.2

Installation
------------

[](#installation)

```
composer require tigamadou/emecef-core-php
```

Or from the monorepo (development):

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

Quick Start
-----------

[](#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:

- [Overview](docs/overview.md)
- [Configuration](docs/configuration.md)
- [Examples](docs/examples.md)
- [DTOs and API reference](docs/dto-and-api.md) — all DTOs, enums, fields, and request/response mapping

Data objects (DTOs) and enums
-----------------------------

[](#data-objects-dtos-and-enums)

The package models all request and response structures from the [e-MECeF API v1.0](https://github.com/tigamadou/emecef/blob/main/docs/e-mecef-api-v1.0.md) specification. For **field-by-field descriptions** and **request/return shapes**, see [DTOs and API reference](docs/dto-and-api.md):

- **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
-------------

[](#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
-----------

[](#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
-------

[](#license)

Proprietary. See repository root for governance.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance86

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~25 days

Total

2

Last Release

71d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/acf4cf1df95ad685538cdf7e3eb4375aaa57ea4e25b3777401a62bfcd6ac873e?d=identicon)[tigamadou](/maintainers/tigamadou)

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tigamadou-emecef-core-php/health.svg)

```
[![Health](https://phpackages.com/badges/tigamadou-emecef-core-php/health.svg)](https://phpackages.com/packages/tigamadou-emecef-core-php)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
