wdmg/yii2-validators

Custom validators for Yii 2.0

Installs: 149

Dependents: 6

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 1

Open Issues: 0

Type:yii2-extension

1.0.6 2020-04-27 22:58 UTC

This package is auto-updated.

Last update: 2020-07-27 23:25:52 UTC


README

Yii2 Downloads Packagist Version Progress GitHub license

Yii2 Validators

Custom validators for Yii2

Requirements

  • PHP 5.6 or higher
  • Yii2 v.2.0.33 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::class, 'stoplist' => ['admin', 'root', 'superuser', ...], 'message' => 'You can not use this value `{value}` for field `{attribute}`'],
        ...
    ];
}

?>

Status and version [in progress development]

  • v.1.0.6 - Update README.md and dependencies
  • v.1.0.5 - Added SerialValidator
  • v.1.0.4 - Added JsonValidator and EmailsValidator
  • v.1.0.3 - Update Yii2 version