henry-ht/ubl21dian 问题修复 & 功能扩展

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

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

henry-ht/ubl21dian

Composer 安装命令:

composer require henry-ht/ubl21dian

包简介

Core for electronic invoicing pre-validation - DIAN UBL 2.1

README 文档

README

Core for electronic invoicing pre-validation - DIAN UBL 2.1.

Fork of the ubl21dian package by Torresoftware, designed to generate electronic documents in UBL 2.1 format in compliance with DIAN regulations in Colombia. This version includes customizations and specific enhancements to integrate with other Laravel solutions or adapt to particular use cases.

UBL 2.1 DIAN DETAILS

Package for electronic invoicing in Colombia

Tags

  • 1: ✅ Contains valid tests with the binary security token (SOAP) and XAdES (XML) signature using sha1, sha256, and sha512 algorithms.
  • 2: ✅ Includes the main templates for consuming the web service; requires curl as a dependency.
  • 3: ✅ Fixes the canonicalization error.
  • 4: ✅ Provides valid tests for sending credit notes and calculating the CUDE.
  • 5: ✅ Licensed under LGPL.
  • 6: ✅ Includes valid tests for sending debit notes and the standard document name.

Functions

  • Document signing
  • Asynchronous sending
  • Status query by zipkey
  • Status query by CUFE
  • Numbering range query
  • Asynchronous test set sending

Example of electronic invoice signing and validation using UBL 2.1 (Laravel)

This snippet demonstrates how to generate the XML of an invoice, digitally sign it, and validate it against the XSD schema using the SignInvoice package.

    use ubl21dian\XAdES\SignInvoice;

    $view = view('dian-xml.Invoice')->with([
        'sale'      => $this->sale
    ]);

    $xml = $view->render();

    $sign = new SignInvoice(storage_path(env('DIAN_PFXPATH')), env('DIAN_PFXPASSWORD'));

    $sign->softwareID = $this->sale->dian_resolution->software_id;
    $sign->pin = env('DIAN_PIN');
    $sign->technicalKey = env('DIAN_TECHNICAL_KEY');
    $sign->sign($xml);

    $xmlSign = $sign->getDocument()->saveXML();

    $validate = $this->validateXmlWithXsd($xmlSign, storage_path('XSD/maindoc/UBL-Invoice-2.1.xsd'));
    /**
     * Validates an XML file against one or multiple XSD schemas.
     *
     * @param string $xmlContent Content of the XML to be validated.
     * @param string|array $xsdPaths Path(s) to the XSD file or XSD files.
     * @return bool Validation result.
     */
    public function validateXmlWithXsd(string $xmlContent, $xsdPath): bool
    {
        $dom = new \DOMDocument();
        $dom->preserveWhiteSpace = false;
        $dom->formatOutput = false;
        $dom->loadXML($xmlContent);

        $valid = false;

        $valid = $dom->schemaValidate($xsdPath);

        return $valid;
    }

henry-ht/ubl21dian 适用场景与选型建议

henry-ht/ubl21dian 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 henry-ht/ubl21dian 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2025-06-18