PHP code example of jbtje / edifact

1. Go to this page and download the library: Download jbtje/edifact 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/ */

    

jbtje / edifact example snippets


$c = new Parser($x);

$c = new Parser();
$c->load($file);
$c->loadString($string);

$c->errors();

$c->get();

$c = new Encoder($x, $wrap = true);

$c = new Encoder();
$c->encode($array, $wrap);

$c->get(); // returns String

        $parser = new Parser($file);
        $parsed = $parser->get();
        $segments = $parser->getRawSegments();
        $analyser = new Analyser();
        $mapping = new MappingProvider('D95B');
        $analyser->loadSegmentsXml($mapping->getSegments());
        $analyser->loadMessageXml($mapping->getMessage('coparn'));
        $analyser->loadCodesXml($mapping->getCodes());
        $analyser->directory = 'D95B';
        $result = $analyser->process($parsed, $segments);                   


$r = new Reader($x);
$sender = $r->readEdiDataValue('UNB', 2);
$Dt = $r->readUNBDateTimeOfPreperation();


$c = new Parser($x);

$r = new Reader();
$r->setParsedFile($c->get());
$sender = $r->readEdiDataValue('UNB', 2);
$Dt = $r->readUNBDateTimeOfPreperation();

$c->errors();

$c->get();

$p = new EDI\Parser($edifile);
$edi = $p->get();

$mapping = new EDI\Mapping\MappingProvider('D95B');

$analyser = new EDI\Analyser();
$segs = $analyser->loadSegmentsXml($mapping->getSegments());
$svc = $analyser->loadSegmentsXml($mapping->getServiceSegments(3));

$interpreter = new EDI\Interpreter($mapping->getMessage('CODECO'), $segs, $svc);
$prep = $interpreter->prepare($edi);

$interpreter->getJson()

$interpreter->getJsonServiceSegments()

$interpreter->getErrors()

['DTM',['7','201309200717','203']]