horat1us / yii2-inn-validator
Yii2 INN (UA) Validator
1.1.0
2020-06-15 21:34 UTC
Requires
- php: >=7.4
- horat1us/inn-parser: ^1.2
- horat1us/yii2-model-schema: ^1.0.1
- yiisoft/yii2: ^2.0.31
Requires (Dev)
- phpunit/phpunit: ^9.2
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-10-30 01:59:32 UTC
README
Installation
composer require horat1us/yii2-inn-validator
InnValidator
Uses horat1us/inn-parser
<?php use Horat1us\Inn\Yii\InnValidator; use Horat1us\Inn; use yii\base; $validator = new Inn\Yii\Validator([ 'minAge' => 18, 'maxAge' => 70, 'enableCheckSum' => true, ]); $validator->validate('3184710691'); $model = new class extends base\Model { public string $inn; public function rules(): array { return [ [['inn',], 'required',], [['inn',], InnValidator::class,], ]; } }; $model->inn = 3184710691; $model->validate();