anper / russian-id-laravel
A set of useful Laravel validation rules for identifiers of Russian individuals and legal entities
Requires
- php: ^7.3|^8.0
- anper/russian-id: ^2.1
- illuminate/contracts: ^8.0|^9.0
- illuminate/support: ^8.0|^9.0
Requires (Dev)
- illuminate/validation: ^8.0
- orchestra/testbench: ^6.0
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^9.0
- squizlabs/php_codesniffer: ^3.6
This package is auto-updated.
Last update: 2024-10-28 16:54:52 UTC
README
A set of useful Laravel validation rules for identifiers of Russian individuals and legal entities.
Install
$ composer require anper/russian-id-laravel
The package will automatically register itself.
Translations
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"
Available rules
- 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'), ]);
Tests
Unit testing
The package is tested with PHPUnit. To run tests:
$ composer test
Static analysis
The code is statically analyzed with PHPStan. To run static analysis:
$ composer stan
License
The MIT License (MIT). Please see License File for more information.