mrbig00/yii2-class-validator

This validator test if an object (instance) is a subtype of a given class

dev-master 2019-08-30 09:07 UTC

This package is auto-updated.

Last update: 2024-09-29 05:48:40 UTC


README

ClassValidator checks if the attribute is a subtype of a given class

Installation

Use the package manager composer to install the Yii2 class validator.

composer require mrbig00/yii2-class-validator

Usage

public function rules(){
   return [
      [['client'], ClassValidator::class, 'skipOnEmpty' => false, 'targetClass' => Client::class],
      ...
   ];
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT