/yii2-validators

Validators for Yii2

Primary LanguagePHPMIT LicenseMIT

Progress Github all releases GitHub version Progress GitHub license

Yii2 Validators

Custom validators for Yii2

Requirements

  • PHP 5.6 or higher
  • Yii2 v.2.0.20 and newest

Installation

To install the validators, run the following command in the console:

$ composer require "wdmg/yii2-validators"

Usage

Example of usecase StopListValidator to model rules:

<?php

use wdmg\validators\StopListValidator;
...

public function rules() {
    return [
        [['attribute'], StopListValidator::className(), 'stoplist' => ['admin', 'root', 'superuser', ...], 'message' => 'You can not use this value `{value}` for field `{attribute}`'],
        ...
    ];
}

?>

Status and version [in progress development]

  • v.1.0.3 - Update Yii2 version