PHP code example of liuyuit / identity-card
1. Go to this page and download the library: Download liuyuit/identity-card 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/ */
liuyuit / identity-card example snippets
ini_set('display_errors', 1);
error_reporting(-1);
= '332522198908021574';
$identityCard = new IdentityCard($identityCardNo);
$identityCard->check(); // true
try {
$birthday = $identityCard->birthday();
echo $birthday . PHP_EOL; // 19890802
$identityCard->age();
$gender = $identityCard->gender();
echo $gender; // 1
$identityCard->constellation();
$identityCard->zodiac();
} catch (\liuyuit\IdentityCard\InvalidIdentityCardException $e) {
}