interficie / laravel-spanishid
Check spanish identity numbers (DNI, CIF, NIE, NIF, SSN)
Installs: 6 666
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
- illuminate/support: ^6|^7|^8|^9|^10
Requires (Dev)
- phpunit/phpunit: ^11.0
This package is auto-updated.
Last update: 2024-11-19 14:09:25 UTC
README
Library to add validations for spanish state-emitted identity document numbers, including NIF, CIF, NIE and Social Security Number (SSN).
Installation
Require this package with composer:
composer require interficie/identity
Usage
You can now check a document using the Facade:
SpanishID::isValidDni('1234foo'); SpanishID::isValidCif('1234foo'); SpanishID::isValidNie('1234foo'); SpanishID::isValidNNSS('1234foo');
You can also use these as validation rules:
$rules = [ 'dni_field' => 'dni', 'cif_field' => 'cif', 'nie_field' => 'nie', 'nif_field' => 'nif', 'nnss_field' => 'nnss', ];
Thanks
-
The original laravel package by mpijierro https://github.com/marcmascort/identity
-
The original code for NIF, CIF AND NIE is in next link:
http://www.michublog.com/informatica/8-funciones-para-la-validacion-de-formularios-con-expresiones-regulares -
Thanks to original code for the validation of the NNSS of:
http://intervia.com/doc/validar-numeros-de-la-seguridad-social/