deft/mrz-parser

There is no license information available for the latest version (dev-master) of this package.

Library to parse machine readable zones (MRZ) of passports and ID cards

dev-master / 1.0.x-dev 2013-02-01 09:42 UTC

This package is auto-updated.

Last update: 2024-11-04 23:47:05 UTC


README

Library to parse machine readable zones (MRZ) of passports and travel documents

Usage

Usage is straightforward:

<?php

$mrz = "P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<L898902C<3UTO6908061F9406236ZE184226B<<<<<14";

// Parse string
$parser = new Deft\MrzParser\MrzParser();
$travelDocument = $parser->parseString($mrz);

// Use getters to access the parsed information
print $travelDocument->getDocumentNumber(); // Will print 'L898902C'

// Parse array of lines
$mrz = [
    "P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<",
    "L898902C<3UTO6908061F9406236ZE184226B<<<<<14"
];
$travelDocument = $parser->parseLines($mrz);