PHP code example of shahonseven / php-mykad

1. Go to this page and download the library: Download shahonseven/php-mykad 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/ */

    

shahonseven / php-mykad example snippets


use Shahonseven\MyKad\MyKad;

$myKad = new MyKad(720413335315);
$myKad2 = new MyKad('720413-33-5315');

echo $myKad->isValid();
// Results: true

echo $myKad->stateName();
// Results: PAHANG

echo $myKad->gender();
// Results: MALE

echo $myKad->dateOfBirth()->format('Y-m-d');
// Results: 1972-04-13

echo $myKad->dateOfBirth()->diffInYears();
// Results: 51
shell
composer