承接 jh3ady/einvoicing 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

jh3ady/einvoicing

Composer 安装命令:

composer require jh3ady/einvoicing

包简介

Anti-Corruption Layer for European e-invoicing (UBL + Factur-X)

README 文档

README

PHP 8.1+ library for producing and validating European e-invoices in UBL 2.1 and Factur-X (CII).

CI

Installation

composer require jh3ady/einvoicing

Quick Start

1. Build an invoice

use Jh3ady\EInvoicing\Enum\CountryCode;
use Jh3ady\EInvoicing\Enum\CurrencyCode;
use Jh3ady\EInvoicing\Enum\InvoiceType;
use Jh3ady\EInvoicing\Enum\TaxCategoryCode;
use Jh3ady\EInvoicing\Model\Invoice;
use Jh3ady\EInvoicing\Model\InvoiceLine;
use Jh3ady\EInvoicing\Model\Item;
use Jh3ady\EInvoicing\Model\MonetaryTotal;
use Jh3ady\EInvoicing\Model\Party;
use Jh3ady\EInvoicing\Model\PostalAddress;
use Jh3ady\EInvoicing\Model\Price;
use Jh3ady\EInvoicing\Model\TaxSubtotal;
use Jh3ady\EInvoicing\Model\TaxTotal;
use Jh3ady\EInvoicing\Model\ValueObject\Amount;
use Jh3ady\EInvoicing\Model\ValueObject\Quantity;

$address = new PostalAddress('10 rue de la Paix', 'Paris', CountryCode::FR, '75002');

$invoice = new Invoice(
    number: 'FA-2024-001',
    issueDate: new \DateTimeImmutable('2024-01-15'),
    type: InvoiceType::Invoice,
    currency: CurrencyCode::EUR,
    seller: new Party(name: 'Seller SAS', address: $address, vatNumber: 'FR12345678901'),
    buyer: new Party(name: 'Buyer SA', address: $address, vatNumber: 'FR98765432101'),
    lines: [
        new InvoiceLine(
            id: '1',
            quantity: new Quantity('2', 'C62'),
            item: new Item(name: 'Consulting service'),
            price: new Price(amount: new Amount('500.00')),
            taxCategory: TaxCategoryCode::StandardRate,
            taxRate: '20.00',
            lineTotal: new Amount('1000.00'),
        ),
    ],
    taxTotal: new TaxTotal(
        taxAmount: new Amount('200.00'),
        subtotals: [
            new TaxSubtotal(
                taxableAmount: new Amount('1000.00'),
                taxAmount: new Amount('200.00'),
                category: TaxCategoryCode::StandardRate,
                taxRate: '20.00',
            ),
        ],
    ),
    monetaryTotal: new MonetaryTotal(
        lineExtensionAmount: new Amount('1000.00'),
        taxExclusiveAmount: new Amount('1000.00'),
        taxInclusiveAmount: new Amount('1200.00'),
        payableAmount: new Amount('1200.00'),
    ),
);

2. Serialize to UBL 2.1

use Jh3ady\EInvoicing\EInvoicing;
use Jh3ady\EInvoicing\Specification;

$xml = EInvoicing::serialize($invoice, Specification::ubl21());

3. Serialize to Factur-X

use Jh3ady\EInvoicing\EInvoicing;
use Jh3ady\EInvoicing\Enum\FacturXProfile;
use Jh3ady\EInvoicing\Specification;

$xml = EInvoicing::serialize($invoice, Specification::facturX(FacturXProfile::EN16931));

4. Validate

$result = EInvoicing::validate($invoice, $spec);

if (!$result->isValid()) {
    foreach ($result->errors() as $error) {
        echo "[{$error->code}] {$error->message}\n";
    }
}

5. Serialize and validate in one step

$output = EInvoicing::process($invoice, $spec);

if ($output->isValid()) {
    file_put_contents('invoice.xml', $output->xml);
}

Supported Formats

Format Specification
UBL 2.1 Specification::ubl21()
Factur-X Minimum Specification::facturX(FacturXProfile::Minimum)
Factur-X BasicWL Specification::facturX(FacturXProfile::BasicWL)
Factur-X Basic Specification::facturX(FacturXProfile::Basic)
Factur-X EN16931 Specification::facturX(FacturXProfile::EN16931)
Factur-X Extended Specification::facturX(FacturXProfile::Extended)

Sandbox

Une application Laravel/Livewire est incluse dans sandbox/ pour tester la lib en local :

cd sandbox
composer install
cp .env.example .env
php artisan key:generate
php artisan serve

Deux modes disponibles :

  • Créer une facture : formulaire complet avec presets (UBL, Factur-X, avoir)
  • Valider un XML : collez du XML UBL ou Factur-X, validation complète (règles métier + XSD)

Requirements

  • PHP 8.1 or higher
  • ext-dom
  • ext-libxml
  • ext-bcmath

License

MIT

jh3ady/einvoicing 适用场景与选型建议

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

它主要适用于以下技术方向: 「xml」 「invoice」 「ZUGFeRD」 「cii」 「ubl」 「factur-x」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 jh3ady/einvoicing 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-05