1. Go to this page and download the library: Download phprsa/id-validator 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/ */
phprsa / id-validator example snippets
use PhpRsaIdValidator\RsaIdValidator;
$validator = new RsaIdValidator();
$result = $validator->validate('9001015800088');
if ($result->valid) {
echo $result->dateOfBirth->format('Y-m-d'); // 1990-01-01
echo $result->gender->value; // Male
echo $result->citizenship->value; // SA Citizen
} else {
echo "Error: {$result->error}";
}
if (RsaIdValidator::isValid($submittedId)) {
// proceed
}