Edifact A PHP library to parse and serialize UN/EDIFACT messages

Getting Started

Usage

Reading Messages

View the API Documentation for this class

Most of the time, you’ll probably receive your EDI message as either a file or a string, there are 2 methods available to create a message from these:

$message = Message::fromFile("/tmp/order.edi");

$message = Message::fromString($ediMessageContents);

Once you have your message, you can get all the segments like so:

foreach ($message->getAllSegments() as $segment) {
}

Or if you only want segments using a particular name:

foreach ($message->getSegments("LIN") as $segment) {
}

And sometimes you only want one segment:

$segment = $message->getSegment("BGM");

See what you can do with Segments here