Coder Social home page Coder Social logo

idcard-1's Introduction

Vitale.Wang API idcard PHP Client 身份号码信息解析

这是Vitale.Wang API的PHP版本封装开发包,由Vitale.Wang提供,一般支持最新的 API 功能。

支持的 PHP 版本: 5.3.3 ~ 5.6.x, 7.0.x

Installation

使用 Composer 安装

  • 在项目中的 composer.json 文件中添加 Organize 依赖:
"require": {
    "wangyi/idcard": "dev-master"
}
  • 执行 $ php composer.phar install$ composer install 进行安装。

直接下载源码安装

直接下载源代码也是一种安装 SDK 的方法,不过因为有版本更新的维护问题,所以这种安装方式十分不推荐,但由于种种原因导致无法使用 Composer,所以我们也提供了这种情况下的备选方案。

  • 下载源代码包,解压到项目中
  • 在项目中引入 autoload:
require 'path_to_sdk/autoload.php';

初始化

use \Idcard\IdcardInit as Idcard;
...
...

    $idcard = new Idcard('11xxxxxxxxxxxxxxxx');

...

OR

$client = new \Idcard\IdcardInit('11xxxxxxxxxxxxxxxx');

检查身份证是否生效

  $check = $idcard->check()->check();

判端性别

  $sex = $idcard->getSex()->getSex();

获取年龄、出生年月、生肖、星座

  //年龄
  $age = $idcard->getAge()->getAge();
  //出生年月日,默认返回格式为Y-m-d,可自定义
  $birthday = $idcard->getAge()->getBirthday('Y年m月d日');
  //出生年份
  $year = $idcard->getAge()->getBirthdayYear();
  //出生月份
  $month = $idcard->getAge()->getBirthdayMonth();
  //出生日
  $day = $idcard->getAge()->getBirthdayDay();
  //生肖
  $ChineseZodiac = $idcard->getAge()->getChineseZodiac();
  //星座
  $Constellation = $idcard->getAge()->getConstellation();

获取地域信息

  //获取省份:河北省
  $province = $idcard->getArea()->getProvince();
  //获取城市:河北省石家庄市
  $city = $idcard->getArea()->getCity();
  //获取详细地址信息
  $area = $idcard->getArea()->getArea();

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/HowieBird/idcard

License

The library is available as open source under the terms of the MIT License.

idcard-1's People

Contributors

wysszetz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.