PHPackages                             chendujin/id-verify - 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. chendujin/id-verify

ActiveLibrary

chendujin/id-verify
===================

Chinese Mainland Personal ID Card Validation

v1.0.1(2y ago)126MITPHPPHP &gt;=5.6.0

Since Jun 28Pushed 2y agoCompare

[ Source](https://github.com/chendujin/id-verify)[ Packagist](https://packagist.org/packages/chendujin/id-verify)[ RSS](/packages/chendujin-id-verify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

IdValidator.php
===============

[](#idvalidatorphp)

**中华人民共和国居民身份证**、**中华人民共和国港澳居民居住证**以及**中华人民共和国台湾居民居住证**号码验证工具（PHP Composer 版）支持 15 位与 18 位号码。

- [Go 版本](https://github.com/guanguans/id-validator)
- [Python 版本](https://github.com/jxlwqq/id-validator.py)
- [Ruby 版本](https://github.com/renyijiu/id_validator)
- [JavaScript 版本](https://github.com/mc-zone/IDValidator)

[![Testing](https://github.com/jxlwqq/id-validator/actions/workflows/testing.yml/badge.svg)](https://github.com/jxlwqq/id-validator/actions/workflows/testing.yml)[![StyleCI](https://camo.githubusercontent.com/e56263de61c301925b18079b37e8ea4142abe283383fd89542e247119b9fc6f9/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3134373735383836322f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/147758862)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/2c2630057902f5c0f9e5b09a42b3b141042beb403114100484642b74bc210689/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a786c7771712f69642d76616c696461746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jxlwqq/id-validator/?branch=master)[![Maintainability](https://camo.githubusercontent.com/702508c0f76070ab5873b0afcfec536a74b8c7f6780d7c9a3b6aa5488b2172db/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f39383838306135636237313365323635323435302f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/jxlwqq/id-validator/maintainability)[![FOSSA Status](https://camo.githubusercontent.com/2cc4d05b7cc42e66093e93e0aae0c8304033ff9f03ba9756c6bf3bb996fa3fe2/68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d2532466a786c77717125324669642d76616c696461746f722e7376673f747970653d736869656c64)](https://app.fossa.io/projects/git%2Bgithub.com%2Fjxlwqq%2Fid-validator?ref=badge_shield)[![996.icu](https://camo.githubusercontent.com/ac8f294a80f65338db545230f1a881b9a382204a1f187c6ff40ee679d42d40ca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c696e6b2d3939362e6963752d7265642e737667)](https://996.icu)

安装
--

[](#安装)

```
composer require "chendujin/id-verify"
```

> 注：如果 require 失败，解决方案见 [\#13](https://github.com/jxlwqq/id-validator/pull/13)。

配置
--

[](#配置)

### Laravel无需配置

[](#laravel无需配置)

### Lumen

[](#lumen)

将下面代码放入 `bootstrap/app.php`

```
$app->register(Chendujin\IdValidator\ServiceProvider::class);
```

使用
--

[](#使用)

> `440308199901101512` 和 `610104620927690` 示例大陆居民身份证均为随机生成的假数据，如撞车，请联系删除。 `810000199408230021` 和 `830000199201300022` 示例港澳台居民居住证为北京市公安局公布的居住证样式号码。

### 在验证器中使用

[](#在验证器中使用)

```
