danielmrdev/laravel-spanish-validator
This package is a set of diferent validation rules for spanish national id numbers like:
Also the package include validators for:
The package can be installed via composer:
composer require danielmrdev/laravel-spanish-validator
The package will automatically register itself.
If you want to edit the validation messages, you should run the following command to publish the translation files into your resources/lang folder:
php artisan vendor:publish --provider="Danielmrdev\SpanishValidator\SpanishValidatorServiceProvider"
v2.0.0 is a major version with breaking changes:
orumad/laravel-spanish-validator → danielmrdev/laravel-spanish-validatorOrumad\SpanishValidator → Danielmrdev\SpanishValidatorTo upgrade:
# Update composer.json
composer require danielmrdev/laravel-spanish-validator:^2.0
# Update your code imports
# Old: use Orumad\SpanishValidator\Validator;
# New: use Danielmrdev\SpanishValidator\Validator;
# Update Laravel service provider references if custom published
# Old: Orumad\SpanishValidator\SpanishValidatorServiceProvider
# New: Danielmrdev\SpanishValidator\SpanishValidatorServiceProvider
The validation rules remain the same, only the namespace has changed.
nifDetermine if the input is a valid "Número de Identificación Fiscal" (tax number for individuals).
nieDetermine if the field under validation is a valid "Número de Idenfiticación para Extranjeros" (identity number for foreigners).
cifThis rule will validate if the input field is a valid "Código de Identificación Fiscal" (tax number for companies).
spanish_tax_numberThis rule validates if the input is a valid spanish tax number: NIF or NIE or CIF.
spanish_personal_idWill validate if the input is a valid personal id number in Spain (NIF or NIE).
nssDetermine if the field under validation is a valid "Número de la Seguridad Social"_ (national security number).
ibanTest if the input field is a valid IBAN bank account number. (This uses the package globalcitizen/php-iban to check the validity of IBAN)
spanish_postal_codeWill check if the postal code is a valid spanish postal code.
spanish_phoneThis tule validates if the input field content is a valid spanish phone number format.
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email hello@danielmr.dev instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
How can I help you explore Laravel packages today?