uuling / id-card
身份证号码验证,兼容18位和15位的新老身份证
1.0
2016-11-27 06:31 UTC
Requires
- php: >=5.4
This package is not auto-updated.
Last update: 2024-09-28 19:58:19 UTC
README
- 身份证号码验证,兼容18位和15位的新老身份证
- 基于国标
GB/T 2260-2007
(中华人民共和国行政区划代码 标准) 。
安装
composer require uuling/id-card
环境要求
- PHP >= 5.4.0
使用说明
use Uuling\Idcard; $identity = new Identity(); $identity->setId('******************'); 或者 $identity = new Identity('******************'); // 验证身份证号码格式是否正确 $identity->isValidate(); // true 或者 false // 获取生日,格式YYYY mm dd $identity->getBirth('-'); // 2015-01-01 $identity->getBirth('/'); // 2015/01/01 // 获取性别 $identity->getGender(); // m $identity->getGender(Identity::GENDER_CN); // 男 // 获取区域 $identity->getArea(); // ['province' => '***', 'city' => '***', 'county' => '***']
选项
许可
MIT