Looking to hire Laravel developers? Try LaraJobs

laravel-spanish-validation maintained by conycom

Description
The most comprehensive Spanish validation rules for Laravel (DNI, NIE, CIF, IBAN, and more).
Last update
2026/08/12 13:06 (dev-main)
License
Links
Downloads
0

Comments
comments powered by Disqus

Laravel Spanish Validation

The most comprehensive, modern, and tested suite of Spanish validation rules for Laravel 10 and 11.

Run tests

Features

  • DNI Validation (Documento Nacional de Identidad)
  • NIE Validation (Número de Identidad de Extranjero)
  • CIF Validation (Código de Identificación Fiscal)
  • Spanish IBAN Validation (Modulo 97 checksum for Spanish bank accounts)
  • Translations included (English and Spanish)

Installation

You can install the package via composer:

composer require conycom/laravel-spanish-validation

Usage

You can use the provided rules in your FormRequests or inline validations. They implement the native Illuminate\Contracts\Validation\ValidationRule interface.

use Conycom\SpanishValidation\Rules\ValidDni;
use Conycom\SpanishValidation\Rules\ValidNie;
use Conycom\SpanishValidation\Rules\ValidCif;
use Conycom\SpanishValidation\Rules\ValidSpanishIban;

$request->validate([
    'dni' => ['required', new ValidDni()],
    'nie' => ['required', new ValidNie()],
    'cif' => ['required', new ValidCif()],
    'iban' => ['required', new ValidSpanishIban()],
]);

Testing

composer test

License

The MIT License (MIT). Please see License File for more information.