zaynasheff / validation-rules
A collection of reusable validation rules for Laravel applications.
1.3.0
2026-07-28 12:58 UTC
Requires
- php: ^8.2
- illuminate/contracts: ^10.0|^11.0|^12.0|^13.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.24
- orchestra/testbench: ^10.0
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
README
A collection of reusable Laravel validation rules for Russian documents and business identifiers.
Currently supported:
- ✅ Age
- ✅ SNILS
- ✅ INN
- ✅ Passport RF Series
- ✅ Passport RF Number
- ✅ Passport RF Subdivision Code
- ✅ Mobile Phone RF
Features
- Laravel native validation rules
- Full Laravel localization support
- English and Russian translations
- PHPUnit tested
- PHPStan compatible
- Laravel 13+
- PHP 8.4+
Requirements
- PHP 8.2+
- illuminate/support 10.0+
Installation
composer require zaynasheff/validation-rules
Usage
Age
use Zaynasheff\ValidationRules\Rules\Age; $request->validate([ 'birth_date' => [ 'required', new Age(min: 18), ], ]);
Between:
new Age(min: 18, max: 65)
SNILS
use Zaynasheff\ValidationRules\Rules\Snils; $request->validate([ 'snils' => [ 'required', new Snils(), ], ]);
Accepted formats:
11223344595
112-233-445 95
INN
use Zaynasheff\ValidationRules\Rules\Inn; $request->validate([ 'inn' => [ 'required', new Inn(), ], ]);
Supports:
- Individual INN (12 digits)
- Legal entity INN (10 digits)
Passport RF Series
use Zaynasheff\ValidationRules\Rules\PassportRFSeries; $request->validate([ 'passport_series' => [ 'required', new PassportRFSeries(), ], ]);
Accepted format:
1234
Passport RF Number
use Zaynasheff\ValidationRules\Rules\PassportRFNumber; $request->validate([ 'passport_number' => [ 'required', new PassportRFNumber(), ], ]);
Accepted format:
123456
Passport RF Subdivision Code
use Zaynasheff\ValidationRules\Rules\PassportRFSubdivisionCode; $request->validate([ 'subdivision_code' => [ 'required', new PassportRFSubdivisionCode(), ], ]);
Accepted formats:
770001
770-001
Mobile Phone RF
Validates a Russian mobile phone number in E.164 format.
use Zaynasheff\ValidationRules\Rules\MobPhoneRF; $request->validate([ 'phone' => ['required', new MobPhoneRF()], ]);
Accepted format:
+79161234567
Examples:
| Value | Result |
|---|---|
| +79161234567 | ✅ |
| +79998887766 | ✅ |
| +74951234567 | ❌ |
| +78005553535 | ❌ |
| 89161234567 | ❌ |
| +7 (916) 123-45-67 | ❌ |
Localization
Package includes translations for:
- English
- Russian
Laravel localization works automatically.
Testing
composer test
Run static analysis:
composer analyse
Run formatter:
composer format
Run all checks:
composer fix
Contributing
Pull requests are welcome.
Please ensure that all tests and static analysis pass before submitting changes.
License
The MIT License (MIT).