A set of useful Laravel validation rules for identifiers of Russian individuals and legal entities.
$ composer require anper/russian-id-laravel
The package will automatically register itself.
If you wish to edit the package translations, you can run the following command to publish them into your resources/lang
folder
$ php artisan vendor:publish --provider="Anper\RussianId\Laravel\RussianIdServiceProvider"
- Anper\RussianId\Laravel\Rules\BikRule
- Anper\RussianId\Laravel\Rules\InnRule
- Anper\RussianId\Laravel\Rules\KppRule
- Anper\RussianId\Laravel\Rules\KsRule
- Anper\RussianId\Laravel\Rules\LegalInnRule
- Anper\RussianId\Laravel\Rules\OgrnipRule
- Anper\RussianId\Laravel\Rules\OgrnOrOgrnipRule
- Anper\RussianId\Laravel\Rules\OgrnRule
- Anper\RussianId\Laravel\Rules\OmsRule
- Anper\RussianId\Laravel\Rules\PersonInnRule
- Anper\RussianId\Laravel\Rules\RsRule
- Anper\RussianId\Laravel\Rules\SnilsRule
The KsRule
and RsRule
require the BIK
attribute in the validated data. You must provide the attribute name in them constructors.
<?php
use Anper\RussianId\Laravel\Rules\BikRule;
use Anper\RussianId\Laravel\Rules\KsRule;
use Anper\RussianId\Laravel\Rules\RsRule;
use Illuminate\Support\Facades\Validator;
$validator = Validator::make([
'bik_field'=> '...',
'ks_field' => '...',
'rs_field' => '...',
], [
'bik_field'=> new BikRule(),
'ks_field' => new KsRule('bik_field'),
'rs_field' => new RsRule('bik_field'),
]);
The package is tested with PHPUnit. To run tests:
$ composer test
The code is statically analyzed with PHPStan. To run static analysis:
$ composer stan
The MIT License (MIT). Please see License File for more information.