PHPackages                             alicfeng/identity-card - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. alicfeng/identity-card

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

alicfeng/identity-card
======================

IdentityCard Library

v3.2.0(2y ago)1228.5k↓56.3%17[1 issues](https://github.com/alicfeng/IdentityCard/issues)MITPHPPHP &gt;=7.1

Since Jan 26Pushed 2y ago5 watchersCompare

[ Source](https://github.com/alicfeng/IdentityCard)[ Packagist](https://packagist.org/packages/alicfeng/identity-card)[ RSS](/packages/alicfeng-identity-card/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (11)Used By (0)

 [ IdentityCard ](https://github.com/alicfeng/identity-card)
============================================================

[](#------identitycard--)

 中国（大陆）公民身份证类

 [ ![Latest Stable Version](https://camo.githubusercontent.com/fb86e23ef8136978a234aecd7866e256594e12f5d91b4609dde5382b0fc1352a/68747470733a2f2f706f7365722e707567782e6f72672f616c696366656e672f6964656e746974792d636172642f762f737461626c652e737667) ](https://packagist.org/packages/alicfeng/identity-card) [ ![Total Downloads](https://camo.githubusercontent.com/c7ee0f4cf60f798823c11a11ef01c4b8485341c7a61f626c09f519d3431b5eba/68747470733a2f2f706f7365722e707567782e6f72672f616c696366656e672f6964656e746974792d636172642f642f746f74616c2e737667) ](https://packagist.org/packages/alicfeng/IdentityCard) [ ![License](https://camo.githubusercontent.com/140a3f26298543729877eb1395649be0d64dc615f3407240c6eed11de0f79fd5/68747470733a2f2f706f7365722e707567782e6f72672f616c696366656e672f6964656e746974792d636172642f6c6963656e73652e737667) ](https://packagist.org/packages/alicfeng/identity-card) [ ![build status](https://camo.githubusercontent.com/4a6516da6875a8238e52283b45fdfbe2756530b7a01dc7c0d5fef70367361679/68747470733a2f2f7472617669732d63692e6f72672f616c696366656e672f4964656e74697479436172642e7376673f6272616e63683d6d6173746572) ](https://github.com/alicfeng/IdentityCard)

🪤 快速安装
------

[](#-快速安装)

```
composer require "alicfeng/identity-card" --optimize-autoloader -vvv
```

🚀 快速使用
------

[](#-快速使用)

```
use AlicFeng\IdentityCard\Information;

$id = 'IdentityCard';

# 获取周岁 |
$age = Information::identityCard()->age($id);

# 获取生日
$birthday = Information::identityCard()->birthday($id);

# 获取性别 | {男为M | 女为F}
$sex = Information::identityCard()->sex($id);

# 获取生肖
$constellation = Information::identityCard()->constellation($id);

# 获取星座
$star = Information::identityCard()->star($id);

# 获取星座
$star = Information::birthday()->star($birthday);

# 获取年龄
$age = Information::birthday()->age($id);

# 生成身份证正面
$front = Information::identityCard()->createFrontImage(...);

# 生成身份证反面
$back = Information::identityCard()->createBackImage(...);

# 获取省
$province = Information::identityCard()->province($id, $default='');

# 获取市
$city = Information::identityCard()->city($id, $default='');

# 获取区
$area = Information::identityCard()->area($id, $default='');
```

---

🏷 更新说明
------

[](#-更新说明)

- **V1.0**

    在版本 `1.0` 中，证件号码错误都是返回`false`。
- **V2.0**

    在版本 `2.0` 中添加异常捕获机制，证件错误将返回异常，只有`c::validate($id)`方法返回`bool`值。
- **V2.3**

    在版本 `2.3` 添加了一个新功能，可以提供身份证信息生成身份证图片。

    注意：图片的大小为：865 \* 540 px
- **V3.0** - `2019.06.25`

    在版本 `3.0` 添加了根据省份正号码获取省、市、区行政地区中文名称。

    行政地区编码源于[中华人民共和国民政部](http://www.mca.gov.cn/)，更新于 `2019-06-21`。
- **V3.0.1** - `2019.11.05`

    行政地区编码源于[中华人民共和国民政部](http://www.mca.gov.cn/)，更新于 `2019-11-05`。
- **V3.1.0** - `2020.02.23`

    行政地区编码源于[中华人民共和国民政部](http://www.mca.gov.cn/)，更新于 `2020-02-19`。

    同时更新了内部实现的机制，调用的方法已经改变了，但是兼容低版本，建议更新旧的调用方法，将于2020.08.01不再支持旧的sdk
- **V3.2.0** - `2024.02.26`行政地区编码源于[中华人民共和国民政部](http://www.mca.gov.cn/)，更新于 `2023-04-23`。

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~232 days

Recently: every ~430 days

Total

9

Last Release

813d ago

Major Versions

v1.0 → v2.02019-04-24

v2.3 → v3.02019-06-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/03b1b279fc8884dc96482b6cd25c7a28877b0f3223de52987651de8917da1ed4?d=identicon)[alicfeng](/maintainers/alicfeng)

---

Top Contributors

[![alicfeng](https://avatars.githubusercontent.com/u/28264271?v=4)](https://github.com/alicfeng "alicfeng (28 commits)")

---

Tags

idcardidentitycardphpididentifyChinaidcardIdentityCardalicfengsamego

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/alicfeng-identity-card/health.svg)

```
[![Health](https://phpackages.com/badges/alicfeng-identity-card/health.svg)](https://phpackages.com/packages/alicfeng-identity-card)
```

###  Alternatives

[cybercog/laravel-optimus

An Optimus bridge for Laravel. Id obfuscation based on Knuth's multiplicative hashing method.

192564.1k](/packages/cybercog-laravel-optimus)[pugx/shortid-php

An implementation of shortid in PHP

52588.5k3](/packages/pugx-shortid-php)[personnummer/personnummer

Validate Swedish social security numbers

34739.3k3](/packages/personnummer-personnummer)[unicodeveloper/laravel-identify

A Laravel 5 Package Provider to Identify/detect a user's browser, device, operating system and Language

19322.0k](/packages/unicodeveloper-laravel-identify)[medz/gb-t-2260

中华人民共和国国家标准 GB/T 2260 行政区划代码

10663.6k5](/packages/medz-gb-t-2260)[consoletvs/identify

A Laravel 5 Package Provider to Identify/detect a user's browser, device, operating system and Language

2775.4k6](/packages/consoletvs-identify)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
