ajgl/validator-es
ajgl/validator-es is a PHP library with validators for common Spanish codes: DNI, NIE, IdCard (DNI or NIE), CCC, and Spanish IBAN. Each implements a simple ValidatorInterface with an isValid() method, making Spanish identifier and bank account validation easy in any PHP or Laravel project.
This library provides some validators for common Spanish codes.
Current supported codes to validate are:
composer require ajgl/validator-es
All validators implements a common interface with only one method:
<?php
namespace Ajgl\ValidatorEs;
interface ValidatorInterface
{
public function isValid(mixed $value): bool;
}
To use any validator, you must instantiate it, and call the isValid method:
<?php
require 'vendor/autoload.php';
$value = 'Y0000000Z';
$validator = new \Ajgl\ValidatorEs\IdCardValidator();
assert($validator->isValid($value));
This library is released under an open source license. See the complete license in the LICENSE file.
Read the CONTRIBUTING.md file.
Developed with ♥ by Antonio J. García Lagar.
If you find this library useful, please add a ★ in the GitHub repository page.
How can I help you explore Laravel packages today?