Comments (8)
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.
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.
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.
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.
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.
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.
Nope, sorry. I used Java only once during the university...
from edifact.
Oh i see, no problem. Thanks for the info, it helped me a lot!
from edifact.
Related Issues (20)
- Release 0.5.0 not available via Composer HOT 2
- Possibility to have IDs instead of name as output from Interpreter::prepare HOT 5
- CDR read HOT 4
- Problems reading RFF segment from EDI-File HOT 1
- Array to string conversion, if an epty array met. HOT 1
- X12 HOT 6
- Package ramsey/array_column is abandoned HOT 2
- Trouble understanding how to get the data we need HOT 5
- Segment is ambiguous HOT 1
- Elements with maxrepeat > 1 should be considered arrays when parsed as json HOT 6
- Reader doesn't return full multi-line texts HOT 4
- UNA does not container new line character HOT 5
- Does IFTMIN:S:93A supported? HOT 5
- UTF8 characters handling in input edi file HOT 15
- How to create edi document with .edi extension for healthcare HOT 4
- readEdiSegmentDTM for SG12 HOT 5
- File has multiple messages HOT 6
- question marks are not parsed correctly HOT 5
- Fatal error on integer-value segments for Encoder HOT 2
- Reader cannot be init with a null param HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from edifact.