Machine Readable Zone SDK for PHP

Fund package maintenance!
alphaolomi

v1.1.0 2023-11-15 08:13 UTC

This package is auto-updated.

Last update: 2024-05-15 09:23:44 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

  1. TD1

    I<UTOD231458907<<<<<<<<<<<<<<<
    7408122F1204159UTO<<<<<<<<<<<6
    ERIKSSON<<ANNA<MARIA<<<<<<<<<<
    
  2. TD2

    I<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<
    D231458907UTO7408122F1204159<<<<<<<6
    
  3. TD3

    P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
    L898902C36UTO7408122F1204159ZE184226B<<<<<14
    
  4. MRV

    V<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
    L8988901C4XXX4009078F96121096ZE184226B<<<<<<
    

Testing

Unit tests are written with PHPUnit.

composer test

Credits

License

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