1. Go to this page and download the library: Download akukoder/mykad-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/ */
akukoder / mykad-validator example snippets
use AkuKoder\MyKadValidator\Validator;
$validator = new Validator;
// This will return false
if ($validator->validate('982404-06-5883')) {
}
// This will return false
if ($validator->validate('982404-06-83')) {
}
// This will return false
if ($validator->validate('980404-00-5335')) {
}
// This will return false
if ($validator->validate('9804AA-00-5335')) {
}
// This will return true
if ($validator->validate('980404-06-5335')) {
}
use AkuKoder\MyKadValidator\Validator;
$validator = new Validator;
// This will throw \AkuKoder\MyKadValidator\Exceptions\InvalidDateException
if ($validator->validate('982404-06-5883', true)) {
}
// This will throw \AkuKoder\MyKadValidator\Exceptions\InvalidLengthException
if ($validator->validate('982404-06-83', true)) {
}
// This will throw \AkuKoder\MyKadValidator\Exceptions\InvalidCodeException
if ($validator->validate('980404-00-5335', true)) {
}
// This will throw \AkuKoder\MyKadValidator\Exceptions\InvalidCharacterException
if ($validator->validate('9804AA-00-5335', true)) {
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.