Question

Is there any php libraries or API's that help when dealing with X12 documents in php? Googling around doesn't help much, so looking for people with experience in this field.

Was it helpful?

Solution

Doing a quick google search, I found a couple of tools that will convert X12 documents to XML. PHP has made a lot of progress in the area of XML parsing.

Is converting to XML first an option?

OTHER TIPS

If you know which Segments and what the meaning in all segments. Then its just about php

$file = file_get_contents('/edi.x12');
$segments = explode(~\n,$file);
foreach($segments as $segment){

$elements = explode('*',$segment);

foreach($elements as $element){

     switch($elements[0]){
          case 'ISA':
              break;
     /// And so on
}
}
}

Then you will have an Array consisting all Segments in the file. If your just iterate over the array it is possible to get all Elements for given Segment.

But for creating a x12 Edi file it is a little bit more tricky.

I dont see the point in first convert to Xml.

not PHP, but python: http://bots.sourceforge.net translates from and to x12.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top