chouaibi/yii2-blacklist-validator

There is no license information available for the latest version (1.0.0) of this package.

blacklist (no-in-array) validator for Yii 2

Installs: 45

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 0

pkg:composer/chouaibi/yii2-blacklist-validator

1.0.0 2015-12-20 15:36 UTC

This package is not auto-updated.

Last update: 2025-10-12 00:47:09 UTC


README

A Validator that will check if a model attribute is blacklisted.

Installation and usage

Installation

$ composer require chouaibi/yii2-notinarray-validator

or

Add the package to your composer.json file.

{
  "require": {
    "chouaibi/yii2-blacklist-validator" : "dev-master"
  }
}

then run

$ composer update

Usage

    use chouaibi\validators\BlackListValidator;

    public function rules() {
        return [
            [['attribute'], BlackListValidator::className(), 'array' => ['black','listed','values']],
        ];
    }

With custom message

    use chouaibi\validators\BlackListValidator;

    public function rules() {
        return [
            [['attribute'], BlackListValidator::className(), 'array' => ['black','listed','values'],'message' => 'The attribute value is reserved. Please check our reserved values ...'],
        ];
    }