PHPackages                             carllee1983/ecpay-einvoice-b2c - 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. [API Development](/categories/api)
4. /
5. carllee1983/ecpay-einvoice-b2c

ActiveLibrary[API Development](/categories/api)

carllee1983/ecpay-einvoice-b2c
==============================

ECPay e-Invoice API wrapper with DTO-based operations, Laravel coordinator, and sandbox-ready docs

v5.0.0(6mo ago)00MITPHPPHP ^8.1

Since May 14Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/CarlLee1983/ecpay-einvoice-B2C)[ Packagist](https://packagist.org/packages/carllee1983/ecpay-einvoice-b2c)[ Docs](https://github.com/CarlLee1983/ecpay-einvoice-B2C)[ RSS](/packages/carllee1983-ecpay-einvoice-b2c/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (6)Versions (32)Used By (0)

綠界電子發票 API（B2C）套件
=================

[](#綠界電子發票-apib2c套件)

此套件封裝綠界電子發票（B2C）API，提供 Operations/Queries/Notifications 的一致介面、DTO-based 欄位建構、加密/解密與 Laravel 整合。

需求
--

[](#需求)

- PHP `^8.3`

安裝
--

[](#安裝)

```
composer require carllee1983/ecpay-einvoice-b2c
```

快速開始
----

[](#快速開始)

```
use CarlLee\EcPayB2C\EcPayClient;
use CarlLee\EcPayB2C\Operations\Invoice;
use CarlLee\EcPayB2C\DTO\InvoiceItemDto;

$server = 'https://einvoice-stage.ecpay.com.tw';
$merchantId = '2000132';
$hashKey = 'ejCk326UnaZWKisg';
$hashIV = 'q9jcZX8Ib9LM8wYk';

$client = new EcPayClient($server, $hashKey, $hashIV);

$invoice = new Invoice($merchantId, $hashKey, $hashIV);
$invoice->setRelateNumber('YEP' . date('YmdHis'))
    ->setCustomerEmail('demo@example.com')
    ->setItems([
        InvoiceItemDto::fromArray(['name' => '商品範例', 'quantity' => 1, 'unit' => '個', 'price' => 100]),
    ])
    ->setSalesAmount(100);

$response = $client->send($invoice);
$data = $response->getData();
```

命令契約（重要）
--------

[](#命令契約重要)

- `EcPayClient::send()` 只接受 `CarlLee\EcPayB2C\Contracts\SendableCommandInterface`（通常直接繼承 `CarlLee\EcPayB2C\Content` 即可）。
- 舊的 `CarlLee\EcPayB2C\InvoiceInterface` 已標記 deprecated（相容層）。
- 若需自行檢視「實際送出的加密內容」，建議呼叫 `Content::getTransportBody()`（`getContent()` 為相容名稱）。

文件
--

[](#文件)

- `docs/README.md`：文件索引與流程圖
- `docs/api-overview.md`：介接流程與模組總覽
- `docs/error-codes.md`：常見錯誤碼與驗證訊息

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance66

Regular maintenance activity

Popularity0

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 72% of commits — single point of failure

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 ~70 days

Recently: every ~5 days

Total

30

Last Release

201d ago

Major Versions

1.3.0 → 2.0.02025-11-21

v2.3.1 → v3.0.02025-11-25

v3.0.0 → v4.0.02025-11-26

v4.2.0 → v5.0.02025-12-15

PHP version history (5 changes)1.0.0PHP &gt;=5.6.4

1.2.0PHP &gt;=7

1.3.0PHP &gt;=7.4

2.0.0PHP ^8.3

v5.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/6cc3f5bb28af8b207b65843e86f3b3e9feb1efd05b8ba888e1fa223a370ab822?d=identicon)[Carl Lee](/maintainers/Carl%20Lee)

---

Top Contributors

[![CarlLee1983](https://avatars.githubusercontent.com/u/8252510?v=4)](https://github.com/CarlLee1983 "CarlLee1983 (54 commits)")[![CarlLeeCHYP](https://avatars.githubusercontent.com/u/173877642?v=4)](https://github.com/CarlLeeCHYP "CarlLeeCHYP (21 commits)")

---

Tags

laraveldtosandboxTaiwaneinvoiceecpay

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/carllee1983-ecpay-einvoice-b2c/health.svg)

```
[![Health](https://phpackages.com/badges/carllee1983-ecpay-einvoice-b2c/health.svg)](https://phpackages.com/packages/carllee1983-ecpay-einvoice-b2c)
```

PHPackages © 2026

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