znsstudio/mrz-parser

A PHP package for MRZ (Machine Readable Zones) code parser for Passport, Visa & Travel Documents.

Fund package maintenance!
rakibdevs

v1.1 2023-05-17 17:39 UTC

This package is not auto-updated.

Last update: 2024-10-31 23:01:36 UTC


README

Latest Version on Packagist

A PHP package for MRZ (Machine Readable Zones) code parser for Passport, Visa & Travel Document (TD1 & TD2).

Installation

You can install the package via composer:

composer require rakibdevs/mrz-parser

Usage

use Rakibdevs\MrzParser\MrzParser;
.....
.....
$data = MrzParser::parse('P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L898902C36UTO7408122F1204159ZE184226B<<<<<10');

var_dump($data);

Output

{
    "type": "Passport",
    "card_no": "L898902C3",
    "issuer": "Utopian",
    "date_of_expiry": "2012-04-15",
    "first_name": "ANNA MARIA",
    "last_name": "ERIKSSON",
    "date_of_birth": "1974-08-12",
    "gender": "Female",
    "personal_number": "ZE184226B",
    "nationality": "Utopian"
}

Supported Document

Passport (TD3)

P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L898902C36UTO7408122F1204159ZE184226B<<<<<10

Visa

V<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L8988901C4XXX7408122F96121096ZE184226B<<<<<<

Or

V<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<
L8988901C4XXX7408122F9612109<<<<<<<<

Travel Document (TD1)

I<UTOD231458907<<<<<<<<<<<<<<<
7408122F1204159UTO<<<<<<<<<<<6
ERIKSSON<<ANNA<MARIA<<<<<<<<<<

Travel Document (TD2)

I<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<
D231458907UTO7408122F1204159<<<<<<<6

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

Special thanks to tetrahydra for organised country list, Al Amin for help extracting information.

License

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