horat1us/yii2-inn-validator

Yii2 INN (UA) Validator

1.1.0 2020-06-15 21:34 UTC

This package is auto-updated.

Last update: 2024-11-30 02:16:22 UTC


README

Latest Stable Version Total Downloads Build Status codecov

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();

License

MIT