All Projects → ofcold → Identity Card

ofcold / Identity Card

Licence: other
A simple proof of identity card of the people's Republic of China.

Projects that are alternatives of or similar to Identity Card

Hookphp
HookPHP基于C扩展搭建内置AI编程的架构系统-支持微服务部署|热插拔业务组件-集成业务模型|权限模型|UI组件库|多模板|多平台|多域名|多终端|多语言-含常驻内存|前后分离|API平台|LUA QQ群:679116380
Stars: ✭ 575 (+273.38%)
Mutual labels:  laravel, symfony, yii, codeigniter, thinkphp, phalcon
Cors
🔮Supported(Laravel/Lumen/PSR-15/Swoft/Slim/ThinkPHP) - PHP CORS (Cross-origin resource sharing) middleware.
Stars: ✭ 266 (+72.73%)
Mutual labels:  laravel, symfony, thinkphp
Manaphp
ManaPHP Framework: Swoole+FPM
Stars: ✭ 271 (+75.97%)
Mutual labels:  laravel, yii, phalcon
Graphqlite
Use PHP Annotations to declare your GraphQL API
Stars: ✭ 370 (+140.26%)
Mutual labels:  laravel, symfony
Endoflife.date
Informative site with EoL dates of everything
Stars: ✭ 296 (+92.21%)
Mutual labels:  laravel, symfony
Weeshop
优雅易用的微信小程序商城,PHP商城。 基于Laravel的基因,来自Symfony的底层技术,来自Drupal Commerce的核心技术,由Drupal中国开源社区维护。QQ群:714023327
Stars: ✭ 337 (+118.83%)
Mutual labels:  laravel, symfony
Cron Manager
A PHP cron task manager for MVC-type applications
Stars: ✭ 396 (+157.14%)
Mutual labels:  yii, codeigniter
Vagrant Php Dev Box
PHP 7 vagrant development box with nginx, php-fpm, MySQL, Symfony, Laravel, ... on Ubuntu 16.04
Stars: ✭ 473 (+207.14%)
Mutual labels:  laravel, symfony
Idea Php Laravel Plugin
Laravel Framework Plugin for PhpStorm / IntelliJ IDEA
Stars: ✭ 537 (+248.7%)
Mutual labels:  laravel, symfony
Easy Short Url
ESU 短网址,可在 Laravel、Yii、ThinkPHP 等框架 Composer 包引入,也可以独立搭建短网址站点
Stars: ✭ 71 (-53.9%)
Mutual labels:  laravel, thinkphp
Ansible Provisioning Tywin
Generate your Ansible provisioning for Symfony2, Laravel and Node.js projects
Stars: ✭ 67 (-56.49%)
Mutual labels:  laravel, symfony
Kantphp2
KantPHP Framework V2
Stars: ✭ 75 (-51.3%)
Mutual labels:  laravel, thinkphp
Backup Manager
Database backup manager for dumping to and restoring databases from S3, Dropbox, FTP, SFTP, and Rackspace Cloud
Stars: ✭ 1,589 (+931.82%)
Mutual labels:  laravel, symfony
Stacker
Stacker - The environment for local web development, ready for use.
Stars: ✭ 356 (+131.17%)
Mutual labels:  laravel, symfony
phpshow
phpshow,简单易用的php框架
Stars: ✭ 14 (-90.91%)
Mutual labels:  codeigniter, thinkphp
PHP-Frameworks-Bench
Popular PHP Frameworks Benchmark.
Stars: ✭ 28 (-81.82%)
Mutual labels:  codeigniter, yii
Search Engine Rank
🐘根据网站关键词,获取网站在各大搜索引擎(百度、360、搜狗)的排名情况,有利于网站seo
Stars: ✭ 197 (+27.92%)
Mutual labels:  laravel, thinkphp
Laravel Zero
A PHP framework for console artisans
Stars: ✭ 2,821 (+1731.82%)
Mutual labels:  laravel, symfony
Sinoci
中国特色化 CodeIgniter
Stars: ✭ 66 (-57.14%)
Mutual labels:  laravel, codeigniter
Php Ext Xlswriter
🚀 PHP Extension for creating and reader XLSX files.
Stars: ✭ 1,734 (+1025.97%)
Mutual labels:  laravel, phalcon

996.icu LICENSE Total Downloads

China (region) citizen ID card tool


Simplified Chinese Documentation


China (Mainland) ID card package, the data from the national standard GB/T 2260-2007 (People's Republic of China administrative divisions code standard).

Other Language

Installing

    composer require ofcold/identity-card

Instructions

A component based on People's Republic of China citizen ID card to obtain the user information.This works for any php framework, but only if the php version is greater than 7.1.

Useing

Useing in Laravel Validation

Multi-language add Please enter a valid Id Card to your json language package.

use Ofcold\IdentityCard\Rules\IdCard;

/**
 * Get the validation rules that apply to the request.
 *
 * @return array
 */
public function rules()
{
    return [
        'id_card'  => [
            'required',
            new IdCard
        ]
    ];
}

Verify your Chinese ID card

    // Result false OR Ofcold\IdentityCard\IdentityCard instance.
    $result = Ofcold\IdentityCard\IdentityCard::make('32010619831029081');

    if ( $result === false ) {

        return 'Your ID number is incorrect';
    }

    print_r($result->toArray());


OR test file.

    php test
$idCard = Ofcold\IdentityCard\IdentityCard::make('320106198310290811', 'en');
//  Use locale, Current supported zh-cn,en
// $idCard = Ofcold\IdentityCard\IdentityCard::make('320106198310290811', 'zh-cn');
if ( $idCard === false ) {

    return 'Your ID number is incorrect';
}
$area = $idCard->getArea();
$gender = $idCard->getGender();
$birthday = $idCard->getBirthday();
$age = $idCard->getAge();
$constellation = $idCard->getConstellation();

Results:

{
    "area": "shan xi sheng yun cheng di qu yun cheng shi",
    "province": "shan xi sheng",
    "city": "yun cheng di qu",
    "county": "yun cheng shi",
    "gender": "Male",
    "birthday": "1980-03-12",
    "zodiac": "Pig",
    "age": 38,
    "constellation": "Pisces"
}

Api

  • getArea() : string Get Area
  • getConstellation() : string Get constellation
  • getZodiac() : string Get zodiac
  • getAge() : int Get age
  • getBirthday(string $foramt = 'Y-m-d') : string Get birthday
  • getGender() : string Get gender
  • getCounty() : string|null Get county
  • getCity() : string|null Get city
  • getProvince() : string|null Get province
  • toArray() : array Get all information.
  • toJson(int $option) : string Json format all information
  • __get() : mixed
  • __toString() : toJson

CHANGELOG

V3.0.0

  • Added Laravel Rule.

V2.0.0

  • Added #2 __get()
  • Added #2 __toString()
  • Modifed #2 static make() Method returns the current object or boolean type
  • Removed #2 Construction method exception verification
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].