yii2mod/yii2-validators Collection of useful validators for Yii Framework 2.0

yii2validatorsyii2cardvalidatoryii2phonevalidator

Yii2 validators

Collection of useful validators for Yii Framework 2.0

Latest Stable Version Total Downloads License Build Status

Installation

The preferred way to install this extension is through composer.

Either run

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

or add

"yii2mod/yii2-validators": "*"

to the require section of your composer.json file.

Usage

  • Credit Card Validator

    public function rules()
    {
        return [
            [['creditCard'], \yii2mod\validators\ECCValidator::className()],
        ];
    }
  • Yii2 phone validator is a validator uses phone number util to validate and format the phone number attribute of model.

    public function rules()
    {
        return [
            [['phone'], \yii2mod\validators\PhoneValidator::className(), 'country' => 'US'], // OR
            [['phone'], \yii2mod\validators\PhoneValidator::className(), 'countryAttribute' => 'country'], // OR
            [['phone'], \yii2mod\validators\PhoneValidator::className(), 'countryCodeAttribute' => 'countryCode'], 
        ];
    }

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

  • 1.222 November 2016
  • 1.105 July 2016
  • 1.013 May 2016

Comments



1.2 is the latest of 3 releases



MIT license
Stats
17 github stars & 3 github forks
4 downloads in the last day
70 downloads in the last 30 days
15083 total downloads