PHPackages                             chujc/validation-support - 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. chujc/validation-support

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

chujc/validation-support
========================

Laravel Lumen 字段验证 支持

1.0.0(7y ago)2351MITPHP

Since May 28Pushed 7y agoCompare

[ Source](https://github.com/chujc/validation-support)[ Packagist](https://packagist.org/packages/chujc/validation-support)[ RSS](/packages/chujc-validation-support/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (2)Used By (0)

 validation-support
====================

[](#-validation-support-)

 Lumen 与 laravel 表单验证规则扩展 (其他框架也可以使用)

安装
--

[](#安装)

```
composer require chujc/validation-support
```

laravel5.5以上版本自动注册

lumen在`bootstrap/app.php` 文件下面 取消如下代码的注释

```
// $app->withFacades();
```

让后添加注册`ServiceProvider`

```
$app->register(ChuJC\Validation\ValidationServiceProvider::class);
```

验证规则
----

[](#验证规则)

- 中文
- 中文 + 字母表
- 中文 + 字母表 + 数字
- 中文 + 字母表 + 数字 + `_-`符号
- 🇨🇳手机号
- 🇨🇳身份证
- 银行卡
- 密码强度验证（不包含长度验证，长度可以先使用string|min:6|max:20 在使用password）

Laravel / Lumen 使用
------------------

[](#laravel--lumen-使用)

```
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;

...
    public function test(Request $request)
    {
        $params = $request->all();

        $validator = Validator::make($params, [
            'id' => 'required|id_card',
            'mobile' => 'required|mobile',
            'back_card' => 'required|back_card',
            'name' => 'required|chs',
            'password' => 'required|string|min:6|max:20|password:2', //使用密码强度2级
        ], [
            'id.*' => '请输入正确的身份证号码',
            'mobile.*' => '请输入正确的手机号码',
            'back_card.*' => '请输入正确的银行卡号',
            'name.*' => '请输入正确中文姓名',
            'password.required' => '请输入密码',
            'password.password' => '密码必须包含数字、小写字母、大写字母',
            'password.*' => '密码长度最短6位,最长20位',
        ]);

        if ($validator->fails()) {
            dump($validator->errors());
        }
    }
...
```

其他使用方法
------

[](#其他使用方法)

```
use ChuJC\Validation\Validate;

Validate::chs('测试'); // 只能是汉字
Validate::chs_alpha('测试A'); // 只能是汉字、字母
Validate::chs_alpha_num('测试A1'); // 只能是汉字、字母和数字
Validate::chs_dash('测试A1_-'); // 只能是汉字、字母、数字和下划线_及破折号-
Validate::mobile('1303236xxxx'); // 🇨🇳手机号规则 避免隐私泄露 请自行测试
Validate::id_card('513030199909090009'); // 🇨🇳身份证号规则 避免隐私泄露 请自行测试
Validate::back_card('6223910712279064'); // 银行卡 避免隐私泄露 请自行测试
/**
 * 密码强度验证等级：默认1级
 * 0级 纯数字 6位 特殊场景（二级密码，支付密码等）使用
 * 1级 必须包含数字、字母（不区分大小写）默认
 * 2级 必须包含数字、大小写字母
 * 3级 必须包含数字、大小写字母、特殊符号
 */
Validate::password('chu111');
```

后续版本约定
------

[](#后续版本约定)

- v.vv.vvv > v 表述大版本号，重大更新修改。vv 小版本号，用于新增验证规则。vvv修复版本号，用户描述，bug等修改
- 新规则 > 如果有需要的新规则大家给发邮件到

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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

2592d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22972932?v=4)[John Chu](/maintainers/chujc)[@chujc](https://github.com/chujc)

---

Tags

chinaidcardlaravellumenmobilevalidationlaravelvalidationlumenvalidateChina

### Embed Badge

![Health badge](/badges/chujc-validation-support/health.svg)

```
[![Health](https://phpackages.com/badges/chujc-validation-support/health.svg)](https://phpackages.com/packages/chujc-validation-support)
```

###  Alternatives

[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel

3893.6M1](/packages/axlon-laravel-postal-code-validation)[sadegh19b/laravel-persian-validation

A comprehensive Laravel validation package for Persian text, numbers, dates, and Iranian national identifiers

18598.1k1](/packages/sadegh19b-laravel-persian-validation)[iamfarhad/validation

🇮🇷 Complete Laravel Persian validation package - Iranian national ID, mobile numbers, Shamsi dates, IBAN/Sheba, postal codes &amp; more. Modern Laravel 10-13 support with both ValidationRule objects &amp; string-based rules.

3017.3k](/packages/iamfarhad-validation)[larapack/command-validation

Enable a method for Artisan Commands to validate the output of methods like `ask`.

124.3k](/packages/larapack-command-validation)[pacerit/laravel-polish-validation-rules

Simple Polish Validation rules for Laravel and Lumen framework

1453.9k](/packages/pacerit-laravel-polish-validation-rules)[laravel-validation-rules/ip

Validate if an ip address is public or private.

1629.7k](/packages/laravel-validation-rules-ip)

PHPackages © 2026

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