dbrkls/edifact
Composer 安装命令:
composer require dbrkls/edifact
包简介
Tools in PHP for UN/EDIFACT
关键字:
README 文档
README
Tools to process EDI messages in UN/EDIFACT format
Supported syntax is version 3.
It's provided in a Composer package:
composer require sabas/edifact
The mapping xml files are provided in a separate repository (https://github.com/sabas/edifact-data). To get them within the repository remember to clone with the --recursive flag, or download them with git submodule update --init --recursive
EDI/Parser
Given an edi message checks the syntax, outputs errors and returns the message as a multidimensional array.
INPUT
$c = new Parser($x);
Where $x could be:
- a url
- a string (wrapped message)
- an array of strings (a segment per entry)
OR
$c = new Parser(); $c->load($file); $c->loadString($string);
OUTPUT
Errors
$c->errors();
Array
$c->get();
EDI/Encoder
Given a multidimensional array (formatted as the output of the parser), returns an EDI string, optionally one segment per line.
INPUT
$c = new Encoder($x, $wrap = true);
$x is a multidimensional array where first dimension is the EDI segment, second contains elements:
- single value
- array (representing composite elements)
$wrap is a boolean, if you need a segment per line. Set to false to disable wrapping
OR
$c = new Encoder(); $c->encode($array, $wrap);
OUTPUT
$c->get(); // returns String
EDI/Analyser
Create from EDI file readable structured text with comments from segments.xml.
INPUT
$analyser = new EDI\Analyser(); $analyser->loadSegmentsXml('edifact/src/EDI/Mapping/d95b/segments.xml');
$urlis the path to orginal EDI message file$parsedis a byEDI\Parser()created EDI messages array
TEXT OUTPUT
$analyser->process($parsed); // returns text
Or
$analyser->process($parsed, $rawSegments);
$rawSegments(optional) is segments in raw format fromEDI\Parser::getRawSegmentsto be printed before each segment in the analysed result
JSON OUTPUT Get a json representation of the array, with the element names as key.
$analyser->process($parsed); $json = $analyser->getJson();
EDI/Reader
Read from EDI file requested segment element values.
INPUT
$r = new Reader($x); $sender = $r->readEdiDataValue('UNB', 2); $Dt = $r->readUNBDateTimeOfPpreperation();
Where X could be:
- a url
- a string (wrapped message)
- an array of strings (a segment per entry)
OR
$c = new Parser($x); $r=new Reader(); $r->setParsedFile($c); $sender = $r->readEdiDataValue('UNB', 2); $Dt = $r->readUNBDateTimeOfPpreperation();
OUTPUT Errors
$c->errors();
Array
$c->get();
EDI/Interpreter
Organizes the data parsed by EDI/Parser using the xml description of the message and the xml segments.
INPUT
$p=new EDI\Parser($edifile); $edi = $p->get(); $analyser = new EDI\Analyser(); $segs =$analyser->loadSegmentsXml('vendor/sabas/edifact-data/D95B/segments.xml'); $interpreter = new EDI\Interpreter('vendor/sabas/edifact-data/D95B/messages/codeco.xml', $segs); $prep = $interpreter->prepare($edi);
OUTPUT
Json
$interpreter->getJson()
Errors (per message)
$interpreter->getErrors()
Example
Edifact
DTM+7:201309200717:203'
Array
['DTM',['7','201309200717','203']]
Syntax data
Processed from EDI PEAR Package by David JEAN LOUIS (izi), downloadable from https://code.google.com/p/izi-sandbox/source/browse/trunk/php/php_edi/.
Notes
Valid characters are: A-Za-z0-9.,-()/'+:=?!"%&*;<> UNECE
dbrkls/edifact 适用场景与选型建议
dbrkls/edifact 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 637 次下载、GitHub Stars 达 1, 最近一次更新时间为 2014 年 11 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「container」 「message」 「edi」 「edifact」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dbrkls/edifact 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dbrkls/edifact 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dbrkls/edifact 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP AMQP Binding Library
A fast and intuitive dependency injection container.
Tools in PHP for UN/EDIFACT
An EDIFACT bundle
Port of olmelabs/EdiEngine to PHP 7.2+
Especificação do formato Cnab240 e Cnab400 traduzida para Yaml
统计信息
- 总下载量: 637
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 28
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2014-11-01