Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Chemaclass/edifact-parser
A parser for a UN/EDIFACT file in PHP
https://github.com/Chemaclass/edifact-parser
edi edifact parser php
Last synced: about 2 months ago
JSON representation
A parser for a UN/EDIFACT file in PHP
- Host: GitHub
- URL: https://github.com/Chemaclass/edifact-parser
- Owner: Chemaclass
- License: other
- Created: 2019-11-08T19:20:33.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-18T15:42:11.000Z (7 months ago)
- Last Synced: 2024-10-28T07:21:01.522Z (about 2 months ago)
- Topics: edi, edifact, parser, php
- Language: PHP
- Homepage: https://packagist.org/packages/chemaclass/edifact-parser
- Size: 863 KB
- Stars: 13
- Watchers: 5
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# EDIFACT Parser
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Chemaclass/EdifactParser/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Chemaclass/EdifactParser/?branch=master)
[![Type Coverage](https://shepherd.dev/github/Chemaclass/EdifactParser/coverage.svg)](https://shepherd.dev/github/chemaclass/EdifactParser)
[![CI](https://github.com/Chemaclass/EdifactParser/workflows/CI/badge.svg?branch=master)](https://github.com/Chemaclass/EdifactParser/actions)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.0-8892BF.svg?style=flat-square)](https://php.net/)EDIFACT stands for `Electronic Data Interchange For Administration, Commerce, and Transport`.
This repository contains a parser for any EDIFACT file to extract the values from any segment
defined in an EDIFACT formatted file.Ok, but... [What is EDIFACT?](/docu/README.md)
## Format of an EDIFACT file
* Each line of the file consists of a set of data that belongs to a specific segment of a message.
* A segment is defined by a tag. Following the rest of the data that belongs to that segment. More about segments [here](/docu/segments/README.md).
* A message is a list of segments. Usually, all segments between the UNH and UNT segments compound a message.
* A transaction is the list of messages that belongs to a file.
### Installation
```bash
composer require chemaclass/edifact-parser
```### Contribute
You are more than welcome to contribute reporting
[issues](https://github.com/gacela-project/gacela/issues),
sharing [ideas](https://github.com/gacela-project/gacela/discussions),
or [contributing](.github/CONTRIBUTING.md) with your Pull Requests.### Basic examples
You can see a full example of [printing segments](example/printing-segments.php).
You can see a full example of [extracting data](example/extracting-data.php).
```php
parse($fileContent);
$firstMessage = $parserResult->transactionMessages()[0];$cnNadSegment = $firstMessage->segmentByTagAndSubId('NAD', 'CN');
$personName = $cnNadSegment->rawValues()[4];var_dump($personName); // 'Person Name'
```