ksdev/mbank-mt940-parser

Parser for the mBank MT940 daily statement export file format.

0.1.0 2015-07-05 18:43 UTC

This package is not auto-updated.

Last update: 2024-04-27 16:14:17 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score

Parser for the mBank MT940 daily statement export file format.

Install

Via Composer

$ composer require ksdev/mbank-mt940-parser

Usage

$parser = new Ksdev\Mt940Parser\Mt940Parser();
try {
    $statement = $parser->parse('path/to/MT940.txt');
}
catch (Exception $e) {
    //
}

Statement structure

array(
    0 =>
        array(
            'generationDate'   => '071023',
            'accountNumber'    => '82114010100000579009005002',
            'statementNumber'  => '11',
            'openingBalance'   =>
                array(
                    'balance'  => 'D',
                    'date'     => '071023',
                    'currency' => 'EUR',
                    'amount'   => '959,45',
                ),
            'transactions'     =>
                array(
                    0 =>
                        array(
                            'valueDate'   => '071023',
                            'bookingDate' => '1023',
                            'balance'     => 'C',
                            'currency'    => 'EUR',
                            'amount'      => '2,21',
                            'code'        => 'TRF',
                            'description' => '973-MT PRZELEW NA RZECZ',
                            'details'     => '973 IBRE PRZELEW WEWNĘTRZNY; Z RACH.: 46114010100000579009004001; OD: KLIENT TESTOWY SP. Z O.O. WARSZAWA, UL. SENATORSKA 18; TYT.: ZWROT NADPŁATY ZA F-RĘ 30/2006; TNR: 145411008036753.010002',
                        ),
                    1 =>
                        array(
                            'valueDate'   => '071023',
                            'bookingDate' => '1023',
                            'balance'     => 'D',
                            'currency'    => 'EUR',
                            'amount'      => '16,36',
                            'code'        => 'TRF',
                            'description' => '944-PRZEL.KRAJ.WYCH.MT.ELX',
                            'details'     => '944 IBRE PRZELEW KRAJOWY; NA RACH.: 40106000760000390201994867; DLA: WYPOŻYCZALNIA PŁYT DVD PRZYGODA MONIUSZKI 7 56-328 BRONOWICE; TYT.: WYPOŻYCZENIE FILMÓW DVD; WALUTA: PLN; KWOTA: 86,20; KURS: 5,2691; TNR: 145410009337393.020001',
                        ),
                    2 =>
                        array(
                            'valueDate'   => '071023',
                            'bookingDate' => '1023',
                            'balance'     => 'D',
                            'currency'    => 'EUR',
                            'amount'      => '1,27',
                            'code'        => 'CHG',
                            'description' => '794-OPŁATY GRUPOWE',
                            'details'     => '794 OPŁATY GRUPOWE; TNR: 145420004413026.000005',
                        ),
                ),
            'closingBalance'   =>
                array(
                    'balance'  => 'D',
                    'date'     => '071023',
                    'currency' => 'EUR',
                    'amount'   => '974.87',
                ),
            'availableBalance' =>
                array(
                    'balance'  => 'D',
                    'date'     => '071023',
                    'currency' => 'EUR',
                    'amount'   => '974.87',
                ),
        ),
    1 =>
        array(...)
);

Testing

$ phpunit

Caution ⚠️

Analyze the code thoroughly before you use it and adjust it to your needs - this project was made for private use.

License

The MIT License (MIT). Please see License File for more information.