All Projects → douyasi → Identity Card

douyasi / Identity Card

Chinese Identity Card package (中国大陆)公民身份证类

Projects that are alternatives of or similar to Identity Card

Composer Patches
Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and composer command for testing/troubleshooting patches.
Stars: ✭ 196 (+24.05%)
Mutual labels:  composer-packages
Jwt Auth Guard
JWT Auth Guard for Laravel and Lumen Frameworks.
Stars: ✭ 319 (+101.9%)
Mutual labels:  composer-packages
Wp Enforcer
Git hooks to encourage well-written WordPress.
Stars: ✭ 107 (-32.28%)
Mutual labels:  composer-packages
Php Mysql Replication
Pure PHP Implementation of MySQL replication protocol. This allow you to receive event like insert, update, delete with their data and raw SQL queries.
Stars: ✭ 213 (+34.81%)
Mutual labels:  composer-packages
bcmath-extended
Extends php BCMath lib for missing functions like floor, ceil, round, abs, min, max, rand for big numbers. Also wraps existing BCMath functions.
Stars: ✭ 59 (-62.66%)
Mutual labels:  composer-packages
Hashids
A small PHP library to generate YouTube-like ids from numbers. Use it when you don't want to expose your database ids to the user.
Stars: ✭ 4,596 (+2808.86%)
Mutual labels:  composer-packages
Telegram Bot Sdk
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
Stars: ✭ 2,212 (+1300%)
Mutual labels:  composer-packages
Srl Php
Simple Regex Language
Stars: ✭ 1,808 (+1044.3%)
Mutual labels:  composer-packages
video-downloader
Video Downloader for Facebook.
Stars: ✭ 63 (-60.13%)
Mutual labels:  composer-packages
Vouchers
A voucher lib
Stars: ✭ 96 (-39.24%)
Mutual labels:  composer-packages
composer-packages
Composer Packages is a Composer plugin for getting information about installed packages in your project.
Stars: ✭ 32 (-79.75%)
Mutual labels:  composer-packages
tdee-calculator
TDEE Calculator is a composer library that calculates how much energy (calories) are burned daily given the weight, height and age or Lean Body Mass.
Stars: ✭ 16 (-89.87%)
Mutual labels:  composer-packages
Awesome Composer
😎 A curated awesome list for Composer, Packagist, Satis, Plugins, Scripts, Composer related resources, tutorials.
Stars: ✭ 738 (+367.09%)
Mutual labels:  composer-packages
Php Textile
Textile markup language parser for PHP
Stars: ✭ 200 (+26.58%)
Mutual labels:  composer-packages
Composer Custom Directory Installer
A composer plugin, to install differenty types of composer packages in custom directories outside the default composer default installation path which is in the vendor folder.
Stars: ✭ 117 (-25.95%)
Mutual labels:  composer-packages
Laravel Messenger
Simple user messaging package for Laravel
Stars: ✭ 2,140 (+1254.43%)
Mutual labels:  composer-packages
Laravel Server Monitor
Server Monitoring Command for Laravel Applications
Stars: ✭ 424 (+168.35%)
Mutual labels:  composer-packages
Packages
Enhances Composer Satis with webhook integrations to GitHub and GitLab
Stars: ✭ 157 (-0.63%)
Mutual labels:  composer-packages
Satis Control Panel
Satis Control Panel (SCP) is a simple web UI for managing your Satis Repository for Composer Packages.
Stars: ✭ 144 (-8.86%)
Mutual labels:  composer-packages
Studio
A workbench for developing Composer packages.
Stars: ✭ 1,021 (+546.2%)
Mutual labels:  composer-packages

中国(大陆)公民身份证类

中国(大陆)公民身份证类包,数据来自国标 GB/T 2260-2007 (中华人民共和国行政区划代码 标准) 。

Latest Stable Version Latest Unstable Version License Total Downloads

ENGLISH README

其它语言实现版本

版本更新记录

  • 2016年期间,发布 1.0 - 1.2 版本,数据来自 GB/T 2260-2007 标准,使用 PHP 内置数组存储。
  • 2017年05月26日,发布 2.x 系列初版 2.0 版本,开始使用 SQLite 作为数据存储源,并公布采集脚本。
  • 2017年09月,发布 2.2 - 2.4 版本,修复某些情况下返回地区(主要县级)信息为空、不准确的问题。
  • 2017年12月03日,发布 2.4 版本,修复返回错误星座问题。
  • 2018年03月27日,发布 2.5 版本,采集截止2018年01月的行政区划数据。
  • 2018年05月13日,发布 2.6 版本,更新其他语言实现,如 Node/Javascript·与 Rust
  • 2019年03月31日,发布 2.7 版本,采集截止到2019年02月的行政区划数据,并修复错误年龄问题。下次(数据库)更新,预计在2020年03月底。
  • 2020年06月29日,发布 2.8 版本,采集截止到2020年02月(可能受疫情影响,民政部官网也只更新到该月份)的行政区划数据。
  • 2020年10月10日,发布 2.9 版本,采集截止到2020年08月的行政区划数据,同时移除采集脚本和历史归档数据(已剥离到 china-divisions 新项目中),下次数据库与版本更新预计在2021年04月底。

安装说明

composer 中添加依赖:

    "require": {
        "douyasi/identity-card": "~2.0"
    }

然后在命令行窗体里执行 composer update 命令,或者参考下面直接使用 composer require 命令:

cd /path/to/your-project
composer require "douyasi/identity-card:~2.0"

特别提示:

本插件需要使用 PDO 连接 sqlite 数据库,故需要安装和开启 pdopdo_sqlite 组件。

使用说明

Laravel 示例代码

创建ID类的实例,然后调用其对应方法。Laravel 5 测试路由示例:

Route::get('test', function() {
    $ID = new Douyasi\IdentityCard\ID();
    $passed = $ID->validateIDCard('42032319930606629x');
    $area = $ID->getArea('42032319930606629x');
    $gender = $ID->getGender('42032319930606629x');
    $birthday = $ID->getBirth('42032319930606629x');
    $age = $ID->getAge('42032319930606629x');
    $constellation = $ID->getConstellation('42032319930606629x');
    return compact('passed', 'area', 'gender', 'birthday', 'age', 'constellation');
});

结果集

上面测试路由将返回下面 json 数据响应:

{
    "status": true,
    "result": {
        "is_pass": true,
        "area": {
            "status": true,
            "result": "湖北省 十堰市竹山县",
            "province": "湖北省",
            "city": "十堰市",
            "county": "竹山县",
            "using": 1
        },
        "gender": "m",
        "birthday": "1993-06-06",
        "age": 23,
        "constellation": "双子座"
    }
}

如果身份证证号校验通过,passed 返回 true ,否则返回 false 。其它字段(如 earagenderbirthdayageconstellation )顾名思义,就不做解释了。

2.0+ 版本 getArea() 方法返回中新增 using 字段,表示行政区划代码当前是否还在使用中。如果为 1 ,说明此身份证证号前6位数字代码(也就是行政区划代码,如 420323 )仍在使用,可以新签发(非续签非补办)此行政区划代码打头的身份证;为 0 表示行政区划已经发生变更(地名可能不变),不再新签发此行政区划代码打头的身份证。

API列表

  • validateIDCard() 获取身份证号码校验结果;
  • getArea() 获取身份证号码原始地区信息;
  • getGender() 获取性别,m 男性 f 女性;
  • getBirth() 获取出生年月日;
  • getAge() 获取年龄;
  • getConstellation() 获取星座。

关于星座月日范围,会有上下 1-2 天的浮动,这里以维基百科资料为主。 维基百科地址: https://zh.wikipedia.org/wiki/%E8%A5%BF%E6%B4%8B%E5%8D%A0%E6%98%9F%E8%A1%93 .

'水瓶座',  // 1.21-2.19 [Aquarius]
'双鱼座',  // 2.20-3.20 [Pisces]
'白羊座',  // 3.21-4.19 [Aries]
'金牛座',  // 4.20-5.20 [Taurus]
'双子座',  // 5.21-6.21 [Gemini]
'巨蟹座',  // 6.22-7.22 [Cancer]
'狮子座',  // 7.23-8.22 [Leo]
'处女座',  // 8.23-9.22 [Virgo]
'天秤座',  // 9.23-10.23 [Libra]
'天蝎座',  // 10.24-11.21 [Scorpio]
'射手座',  // 11.22-12.20 [Sagittarius]
'魔羯座',  // 12.21-1.20 [Capricorn]

在线 API 地址: http://www.yascmf.com/api/identity-card?pid=42032319930606629x .

数据爬虫

请参考 china-divisions 项目 crawler 目录下 readme 文件。

参考资源

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].