PHP code example of chemaclass / edifact-parser
1. Go to this page and download the library: Download chemaclass/edifact-parser library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
chemaclass / edifact-parser example snippets
declare(strict_types=1);
use EdifactParser\EdifactParser;
++12345+DE'
...
EDI;
$parserResult = EdifactParser::createWithDefaultSegments()->parse($fileContent);
$firstMessage = $parserResult->transactionMessages()[0];
$nadSegment = $firstMessage->segmentByTagAndSubId('NAD', 'CN');
$personName = $nadSegment->rawValues()[4]; // 'Person Name'