alphaolomi / mrz
Machine Readable Zone SDK for PHP
Fund package maintenance!
alphaolomi
v1.1.0
2023-11-15 08:13 UTC
Requires
- php: ^8.0
Requires (Dev)
- phpunit/phpunit: ^10.4
This package is auto-updated.
Last update: 2024-12-15 10:26:28 UTC
README
Machine Readable Zone for PHP, originally based on mrz
Install
Via Composer
composer require alphaolomi/mrz
Usage
Writing
use Alphaolomi\Mrz\Mrz; $mrz = new Mrz("I", "Tanzania", "D23148958907", date("dmy",strtotime("1999-10-14")), "M", date("dmy",strtotime("2030-12-31")), "TZA", "OLOMI", "ALPHA"); echo $mrz->TD1CodeGenerator();
Reading
use Alphaolomi\Mrz\MrzParser; $mrzParser = new MrzParser(); $mrzOcrString = 'PTUNKKONI<<MARTINA<<<<<<<<<<<<<<<<<<<<<<<<<<K0503499<8UNK9701241F06022201170650553<<<<10'; $mrzData = $mrzParser->parse($mrzOcrString); print(json_encode($mrzData, JSON_PRETTY_PRINT));
Reading Formats Supported
-
TD1
I<UTOD231458907<<<<<<<<<<<<<<< 7408122F1204159UTO<<<<<<<<<<<6 ERIKSSON<<ANNA<MARIA<<<<<<<<<<
-
TD2
I<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<< D231458907UTO7408122F1204159<<<<<<<6
-
TD3
P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<< L898902C36UTO7408122F1204159ZE184226B<<<<<14
-
MRV
V<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<< L8988901C4XXX4009078F96121096ZE184226B<<<<<<
Testing
Unit tests are written with PHPUnit.
composer test
Credits
- Evandro Kondrat Original Author
- Alpha Olomi
- Nascent Michael
- All Contributors
License
The MIT License (MIT). Please see License File for more information.