New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

godruoyi/laravel-idcard-validator

Laravel 身份证验证器
5,644 9
Install
composer require godruoyi/laravel-idcard-validator
Latest Version:1.0.4
Laravel:5 – 8
License:MIT
Last Updated:Jun 4, 2021
Links: GitHub  ·  Packagist
Maintainer: godruoyi

laravel-idcard-validator

Build Status StyleCI Latest Stable Version Latest Unstable Version Total Downloads License Scrutinizer Code Quality Code Coverage FOSSA Status

安装

$ composer require godruoyi/laravel-idcard-validator -vvv

使用

Laravel 版本小于 5.5 时,需要手动在 app\config.php 添加 service provider:

Godruoyi\LaravelIdCard\ServiceProvider::class,

通过 Validator 面门使用:

Validator::make([
    'idcard' => '110101199801012385',
], [
    'idcard' => 'required|string|idcard',
]);

通过 FormRequest 使用:

class UserRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'idcard' => 'required|idcard',

            // 或者
            'idcard' => ['required', new \Godruoyi\LaravelIdCard\Rule],
        ];
    }
}

验证不通过时,默认返回 无效的身份证号码。

License

FOSSA Status

Related Packages

avto-dev/identity-laravel

IDEntity for Laravel

31,604 3
worksome/laravel-onfido

A Laravel wrapper for the Onfido PHP client

464,877 1
andrevalentin/laravel-onfido

A Laravel wrapper for the Onfido PHP client

170,030 4
filafly/filament-identity-column

A column for Filament Tables to which combines an avatar, name and description.

12,345 7
goldnead/statamic-identity-contracts

Identity foundation for Statamic addons: a stable Identity value object and reso...

7,584 0

Version History

Version Released Laravel License
1.0.4 5.* || ^6.0 || ^7.0 || ^8.0 MIT
1.0.3 5.* MIT
1.0.2 5.* MIT
1.0.1 5.* MIT
1.0.0 5.* MIT