PHPackages                             uuling/id-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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. uuling/id-card

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

uuling/id-card
==============

身份证号码验证，兼容18位和15位的新老身份证

1.0(9y ago)169.0k↓87.5%5MITPHPPHP &gt;=5.4

Since Nov 27Pushed 9y ago1 watchersCompare

[ Source](https://github.com/uuling/id-card)[ Packagist](https://packagist.org/packages/uuling/id-card)[ Docs](https://github.com/uuling/id-card)[ RSS](/packages/uuling-id-card/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

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

[](#中国大陆公民身份证类包)

- 身份证号码验证，兼容18位和15位的新老身份证
- 基于 国标 `GB/T 2260-2007` (中华人民共和国行政区划代码 标准) 。

安装
--

[](#安装)

`composer require uuling/id-card`

环境要求
----

[](#环境要求)

- PHP &gt;= 5.4.0

使用说明
----

[](#使用说明)

```
use Uuling\Idcard;

$identity = new Identity();
$identity->setId('******************');
或者
$identity = new Identity('******************');

// 验证身份证号码格式是否正确
$identity->isValidate();
// true 或者 false

// 获取生日，格式YYYY mm dd
$identity->getBirth('-');
// 2015-01-01
$identity->getBirth('/');
// 2015/01/01

// 获取性别
$identity->getGender();
// m
$identity->getGender(Identity::GENDER_CN);
// 男

// 获取区域
$identity->getArea();
// ['province' => '***', 'city' => '***', 'county' => '***']
```

### 选项

[](#选项)

***选项******描述***Identity::GENDER\_EN性别显示方式：英文首字符【默认】(m/f)Identity::GENDER\_CN性别显示方式：中文(男/女)License
-------

[](#license)

MIT

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3506d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/930bc840164e6ec7e922e460fd8a807d079dd834411167989c192261faa4a7b7?d=identicon)[uuling](/maintainers/uuling)

---

Top Contributors

[![uuling](https://avatars.githubusercontent.com/u/11503667?v=4)](https://github.com/uuling "uuling (2 commits)")

---

Tags

identitycardID Card

### Embed Badge

![Health badge](/badges/uuling-id-card/health.svg)

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

###  Alternatives

[inacho/php-credit-card-validator

Validates popular debit and credit cards numbers against regular expressions and Luhn algorithm. Also validates the CVC and the expiration date

2081.4M11](/packages/inacho-php-credit-card-validator)[jlorente/php-credit-cards

A PHP package to perform operations on debit and credit cards like format, validate brand, number and Luhn algorithm. It validates popular brands like Visa, Mastercard, American Express, etc.

45458.9k1](/packages/jlorente-php-credit-cards)[nekman/luhn-algorithm

Implementation of the Luhn algorithm in PHP. Used in validation of credit card numbers and some national identification numbers.

20873.0k](/packages/nekman-luhn-algorithm)

PHPackages © 2026

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