Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Edi Parser Laravel Package

boda/edi-parser

Simple positional EDI parser that transforms a raw fixed-width EDI string into a structured key-value array using templates. Supports parsing header/body/footer sections and grouped lines for nested records. Install via Composer and use as a Symfony bundle.

View on GitHub
Deep Wiki
Context7

Edi Parser Bundle

Codacy Badge Code Climate

A simple positional edi parser to transform a string to a key-value array based on a template

Installation

Installation using composer is really easy: this command will add "boda/edi-parser" to your composer.json and will download the bundle:

composer require boda/edi-parser

Enable the bundle in your kernel:

<?php
// app/AppKernel.php
public function registerBundles()
{
	$bundles = array(
		// ...
		new Boda\EdiParserBundle\BodaEdiParserBundle(),
	);
}

How to use

Use it inside a controller

@Todo : Rewrite example

Result

array:3 [▼
  "header" => array:5 [▼ // Header
    "IDENTIFIER" => "00"
    "DOT" => "."
    "NUMBER" => "00"
    "TEST" => " "
    "HEADER" => "HEADER"
  ]
  "body" => array:2 [▼ // Body
    1 => array:2 [▼ // Group 1
      0 => array:5 [▼ // Group 1 header
        "IDENTIFIER" => "41"
        "DOT" => "."
        "NUMBER" => "00"
        "TEST" => " "
        "CONTENT" => "CONTENT1"
      ]
      1 => array:7 [▼ // Group 1 line
        "IDENTIFIER" => "41"
        "DOT" => "."
        "NUMBER" => "20"
        "TEST" => " "
        "CONTENT" => "CONTENT2"
        "SPACE" => " "
        "SUBLINE" => "subline"
      ]
    ]
    2 => array:1 [▼ // Group 2
      0 => array:5 [...] // Group 2 header
    ]
  ]
  "footer" => array:5 [▼ // Footer
    "IDENTIFIER" => "99"
    "DOT" => "."
    "NUMBER" => "00"
    "TEST" => " "
    "CONTENT" => "FOOTER"
  ]
]

To-Do

Well, a lot of stuff to improve I guess, let's do a list

  • Customize with configuration (with or without header/footer, nested level)
  • Do some proper error handling for missing arguments
  • Define different model for differents EDI.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed