定制 greenter/ubl-validator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

greenter/ubl-validator

最新稳定版本:v2.2.0

Composer 安装命令:

composer require greenter/ubl-validator

包简介

OASIS Universal Business Language Schema Validator UBL v2.0, UBL v2.1

README 文档

README

Github Actions Coverage Status Codacy Badge Mutation Badge
OASIS Universal Business Language (UBL) Schema Validator.

Install

Via Composer from packagist.org.

composer require greenter/ubl-validator

Examples

Simple usage.

use Greenter\Ubl\UblValidator;

$xml = file_get_contents('20000000001-01-F001-1.xml');

$validator = new UblValidator();

if ($validator->isValid($xml)) {
  echo 'Success!!!';
} else {
  echo $validator->getError();
}

Above example follows next steps:

  • Resolve <cbc:UBLVersionID>
  • Find XSD file in base directory
  • Run schemaValidate and gets result

Change UBL XSD directory

This package not include all UBL xsd, but you can add others xsd directory and use other UBL version.

use Greenter\Ubl\UblValidator;
use Greenter\Ubl\Resolver\UblPathResolver;

$ubl = new UblValidator();
$ubl->pathResolver = new UblPathResolver();
$ubl->pathResolver->baseDirectory = './my-ubl-xsd';

echo $ubl->isValid('<Invoice ...>');

/my-ubl-xsd directory follows this structure:

\my-ubl-xsd
│
├─2.1/
│   ├─ common/
│   └─ maindoc/
│
├─2.2/
│   ├─ common/
│   └─ maindoc/

You can download UBL xsd from oasis-open

统计信息

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

GitHub 信息

  • Stars: 14
  • Watchers: 3
  • Forks: 12
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-25