ouhaohan8023/id-info

chinese id card info for laravel

0.0.7 2024-09-25 07:01 UTC

This package is auto-updated.

Last update: 2024-12-25 07:31:52 UTC


README

1. 安装

composer require ouhaohan8023/id-info

2. 配置

php artisan vendor:publish --provider="Ouhaohan8023\IDInfo\IDInfoServiceProvider"

迁移   php artisan migrate
初始化  php artisan id-info:init

使用

// 获取身份证信息
$id = '132235196706122646';
$m = IDInfoFacade::info($id);
dd($m);
dd($m->getProvince());

Ouhaohan8023\IDInfo\Model\IDInfoModel {
  +"province_code": 130000
  +"city_code": 132200
  +"area_code": 132235
  +"province": "xx省"
  +"city": "xx市"
  +"area": "xx县"
  +"age": 18
  +"sex": "男"
  +"zodiac": "猴"
}

// 检查18位身份证是否合法
$str = "141031199604270069";
$d = IDInfoFacade::check18($str); // bool
dd($d);