Skip to content

Collection of useful validators for Yii Framework 2.0

Notifications You must be signed in to change notification settings

yiier/yii2-validators

Repository files navigation

Validators for Yii2

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
    ];
}

……

About

Collection of useful validators for Yii Framework 2.0

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages