PHPackages                             d3yii2/d3edi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. d3yii2/d3edi

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

d3yii2/d3edi
============

EDI

139PHP

Since Apr 1Pushed 4y ago3 watchersCompare

[ Source](https://github.com/d3yii2/d3edi)[ Packagist](https://packagist.org/packages/d3yii2/d3edi)[ RSS](/packages/d3yii2-d3edi/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

\[EDIFACT messaging\[()
==============================================================

[](#edifact-messaginghttpsenwikipediaorgwikiedifact)

Features
--------

[](#features)

- Collect EDI messages in DB
- Other processes process collected messages and registries
    - status processed and ref records
    - status error and error message

used packages
-------------

[](#used-packages)

- [sabas/edifac](https://github.com/php-edifact/edifact) - Tools to process EDI messages in UN/EDIFACT format
- [php-edifact/edifact-mapping](https://github.com/php-edifact/edifact-mapping) - xml files for EDIFACT messages
- [unyii2/yii2-panel](https://github.com/unyii2/yii2-panel) - panel controller and widget

DB Schema
---------

[](#db-schema)

[![DB Schema](/doc/DbSchema.png)](/doc/DbSchema.png)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ composer require d3yii2/d3edi "*"

```

or add

```
"d3yii2/d3edi": "*"

```

to the `require` section of your `composer.json` file.

Methods
-------

[](#methods)

Usage
-----

[](#usage)

### map edi fata to model attributes

[](#map-edi-fata-to-model-attributes)

```
class DepoEdiBooking extends BaseDepoEdiBooking
{
    public function loadEdi($ediMessage): void
    {
        $r = $ediMessage->readEdiMessage();
        $this->booking_ref_number = $r->readEdiDataValue(['RFF',['1'=>'BN']],1,0);
        $this->carier = $r->readEdiDataValue(['NAD',['1'=>'CA']],2,0);
        $this->containerType = $r->readEdiDataValue(['EQD',['1'=>'CN']],3,0);
        if(!$this->cont_type_id = CargoContTypeDictionary::getIdByEdiCode($containerType)){
            $this->cont_type_id = null;
            $this->addError('cont_type_id','Undefined container type: ' . $containerType);
        }
    }
}
```

### procesing

[](#procesing)

```
        $cnt = 0;
        foreach(EdiMessage::find()->allNews() as $ediMessage){
            if(!$transaction = $this->module->db->begintransaction()){
                throw new \yii\db\Exception('can not start Begin transaction');
            }
            try {
                $ediBooking = new DepoEdiBooking();
                $ediBooking->loadEdi($ediMessage);
                if ($ediBooking->hasErrors() || !$ediBooking->validate()) {
                    $ediMessage->saveError($ediBooking->getErrors());
                    continue;
                }
                if (!$ediBooking->save()) {
                    throw new D3ActiveRecordException($ediBooking);
                }

                $ediMessage->saveProcessed($ediBooking);

                $transaction->commit();
                $cnt ++;
                continue;
            }catch (Exception $e){
                $transaction->rollBack();
                Yii::error($e->getMessage());
                Yii::error($e->getTraceAsString());
                $ediMessage->saveError($e->getMessage());
            }
        }

        return $cnt;

    }
```

### Panle for unprocessed messages

[](#panle-for-unprocessed-messages)

For showing unprocessed messages can use panel solution [Yii2Panel](https://github.com/unyii2/yii2-panel)

#### add widget

[](#add-widget)

```
echo \unyii2\yii2panel\PanelWidget::widget([
    'name' => 'MyAllerts',
]);
```

#### to module add parameter panels

[](#to-module-add-parameter-panels)

```
class MyModule extends Module
{

    /**
     * @var array panels for PanelWidgets
     */
    public $panels;
```

#### in module config add widget

[](#in-module-config-add-widget)

```
        'mymodule' => [
            'class' => 'MyModule',
            'panels' => [
                'MyAllerts' =>
                [
                    [
                        'route' => 'edi/panel/message',
                     ]
                 ]
            ],
        ],
```

#### in EDI module can set role for access to panel. Otherwise every authorised user has access to panle widget

[](#in-edi-module-can-set-role-for-access-to-panel-otherwise-every-authorised-user-has-access-to-panle-widget)

```
        'edi' => [
            'class' => 'd3yii2\d3edi\Module',
            'accessRulesMessageRoles' => ['Depo3EdiFull']
        ],
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 Bus Factor1

Top contributor holds 95.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/542187ba859514d10d0952dca77df8ea889a9651b249d0b5b513da791fd2919b?d=identicon)[uldisn](/maintainers/uldisn)

---

Top Contributors

[![uldisn](https://avatars.githubusercontent.com/u/3525344?v=4)](https://github.com/uldisn "uldisn (23 commits)")[![anothersoftware-lv](https://avatars.githubusercontent.com/u/9327511?v=4)](https://github.com/anothersoftware-lv "anothersoftware-lv (1 commits)")

### Embed Badge

![Health badge](/badges/d3yii2-d3edi/health.svg)

```
[![Health](https://phpackages.com/badges/d3yii2-d3edi/health.svg)](https://phpackages.com/packages/d3yii2-d3edi)
```

###  Alternatives

[smart-crowd/simple-sms-drivers

Addition providers for simple SMS laravel package

101.0k](/packages/smart-crowd-simple-sms-drivers)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
