Giter Site home page Giter Site logo

Comments (8)

sabas avatar sabas commented on May 24, 2024

Hello,
it's a library, so you need to use it to write your program, phpunit is only for testing the code.
See the readme for how to use it https://github.com/php-edifact/edifact#ediparser

How do you plan to use it, could you make an example so I can understand and explain what you'd need to do?

from edifact.

luiggicc avatar luiggicc commented on May 24, 2024

I need to read Edi files for a maritime industry, the files are CODECO and COARRI type. I need to send a file (.edi file) to the app, the app must read that file, get the segments and insert on a table on DB (postgresql). Because of that i'm looking a functional example that i could use as a guide to my project.

from edifact.

sabas avatar sabas commented on May 24, 2024

I work in the same industry :-)
Try EDI\Interpreter, you can then process the resulting array to get the fields you need to insert into your database.

Extended example to have a list of containers and event date from a codeco

$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);
$array1= $prep[0]['SG5'];

foreach ($array1 as $units) {
        echo $units['equipmentDetails']['equipmentIdentification']['equipmentIdentificationNumber'];
        echo $units['datetimeperiod']['datetimeperiod']['datetimeperiod'];
        echo "<br />";
}

from edifact.

luiggicc avatar luiggicc commented on May 24, 2024

I see, are you running on xampp? My system is based on java, so i must recreate this or make a webservice.

The $edifile is an input?

Thanks for the soon answer.

from edifact.

sabas avatar sabas commented on May 24, 2024

On the windows dev system I'm using xampp, on linux Apache+PHP.
$edifile could be an EDI string or an url.
If you're on Java you could have a look at java libraries like Smooks (http://www.smooks.org/)

from edifact.

luiggicc avatar luiggicc commented on May 24, 2024

I see, i just found smooks, there's so so documentation, the bad part i'm the example kind of guy. Because i found some use Talend Open Studios or Eclipse. I use (and love) Netbeans.
I see, i just can call a url for some tests on php. Thanks for that.

Have you developed some edi reading on java?

from edifact.

sabas avatar sabas commented on May 24, 2024

Nope, sorry. I used Java only once during the university...

from edifact.

luiggicc avatar luiggicc commented on May 24, 2024

Oh i see, no problem. Thanks for the info, it helped me a lot!

from edifact.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.