ivanomatteo / laravel-codice-fiscale
Laravel validator for italian fiscal code
Installs: 18 299
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: ^7.2 | ^8.0
- illuminate/support: ^7.0 | ^8.0 | ^9.0
- ivanomatteo/codice-fiscale: 0.1.9
- laravel/framework: ^6.0 | ^7.0 | ^8.0 | ^9.0
Requires (Dev)
- orchestra/testbench: ^4.0 | ^5.0 | ^6.0 | ^7.0
- phpunit/phpunit: ^7.5 | ^8.0 | ^9.0
README
Laravel validator for italian fiscal code
Installation
You can install the package via composer:
composer require ivanomatteo/laravel-codice-fiscale
Usage
publish lang
php artisan vendor:publish --provider "IvanoMatteo\LaravelCodiceFiscale\LaravelCodiceFiscaleServiceProvider" --tag lang php artisan vendor:publish --provider "IvanoMatteo\LaravelCodiceFiscale\LaravelCodiceFiscaleServiceProvider" --tag config
/* Fiscal code fields name: name familyName dateOfBirth sex cityCode */ $validated = Request::validate( [ // first parameter: the field containing the fiscal code // second parameter: the corrisponding filed name for matching 'dob' => 'required|codfisc:fiscalCode,dateOfBirth', 'first_name' => 'required|codfisc:fiscalCode,name', 'last_name' => 'required|codfisc:fiscalCode,familyName', //second parameter: can be omitted if the filed name is alredy correct 'sex' => 'required|codfisc:fiscalCode', 'cityCode' => 'required|codfisc:fiscalCode', 'fiscalCode' => 'required|codfisc', ]); $validated = Request::validate( [ 'first_name' => 'required', 'last_name' => 'required', 'dob' => 'required', 'sex' => 'required', 'cityCode' => 'required', // all rules on fiscal code 'fiscalCode' => 'required|codfisc:first_name=name,last_name=familyName,dob=dateOfBirth,sex=sex,cityCode=cityCode', ]); $validated = Request::validate( [ // ... // just check the format 'fiscalCode' => 'required|codfisc', ]);
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email ivanomatteo@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.