PHP code example of talifhani / za-id-parser
1. Go to this page and download the library: Download talifhani/za-id-parser library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
talifhani / za-id-parser example snippets
use Talifhani\ZaIdParser\IDNumberParser;
$idNumberData = (new IDNumberParser($idNum))->parse();
echo "ID Number: ".$idNumberData->getIdNumber()."<br />";
echo "Birthdate: ".$idNumberData->getBirthdate()."<br />";
echo "Age: ".$idNumberData->getAge()."<br />";
echo "Citizenship: ".$idNumberData->getCitizenship()."<br />";
echo "Gender: ".$idNumberData->getGender()."<br />";
echo "Is Valid ID: ".($idNumberData->isValid() ? 'Yes' : 'No');
print_r($idNumberData->toArray());
/*
(
[birthdate] => 1988-09-15
[age] => 30
[gender] => Female
[citizenship] => South African
[valid] => 1
)
*/