PHP code example of alicfeng / identity-card

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

    

alicfeng / identity-card example snippets


use AlicFeng\IdentityCard\Information;

$id = 'IdentityCard';

# 获取周岁 | 
$age = Information::identityCard()->age($id);

# 获取生日
$birthday = Information::identityCard()->birthday($id);

# 获取性别 | {男为M | 女为F}
$sex = Information::identityCard()->sex($id);

# 获取生肖
$constellation = Information::identityCard()->constellation($id);

# 获取星座
$star = Information::identityCard()->star($id);

# 获取星座
$star = Information::birthday()->star($birthday);

# 获取年龄
$age = Information::birthday()->age($id);

# 生成身份证正面
$front = Information::identityCard()->createFrontImage(...);

# 生成身份证反面
$back = Information::identityCard()->createBackImage(...);

# 获取省
$province = Information::identityCard()->province($id, $default='');

# 获取市
$city = Information::identityCard()->city($id, $default='');

# 获取区
$area = Information::identityCard()->area($id, $default='');