yiier/yii2-validators

Validators for Yii2

Installs: 2 535

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 4

Forks: 0

Open Issues: 0

Type:yii2-extension

v0.3 2020-08-21 07:25 UTC

This package is auto-updated.

Last update: 2024-10-21 16:13:02 UTC


README

Validators for Yii2

Latest Stable Version Total Downloads Latest Unstable Version License

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yiier/yii2-validators "*"

or add

"yiier/yii2-validators": "*"

to the require section of your composer.json file.

Method Listing

中国身份证号码验证

public function rules()
{
    return [
        // ... 
        ['id_card', \yiier\validators\IdCardValidator::class],
        // code
    ];
}

Array Validator

public function rules()
{
    return [
        // ... 
        ['product_ids', \yiier\validators\ArrayValidator::class],
        // code
    ];
}

Phone Validator

public function rules()
{
    return [
        // ... 
        ['phone', \yiier\validators\PhoneValidator::class],
        // code
    ];
}

Money Validator

public function rules()
{
    return [
        // ... 
        ['amount', \yiier\validators\MoneyValidator::class],
        ['amount', \yiier\validators\MoneyValidator::class, 'allowsNegative' => true],
        // code
    ];
}

……