PHPackages                             orumad/laravel-spanish-validator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. orumad/laravel-spanish-validator

Abandoned → [danielmrdev/laravel-spanish-validator](/?search=danielmrdev%2Flaravel-spanish-validator)Library[Validation &amp; Sanitization](/categories/validation)

orumad/laravel-spanish-validator
================================

Laravel validator for spanish stuff: NIF, NIE, CIF, NSS, IBAN, Postal Code, Phone numbers

2.0.0(1mo ago)2622.4k↓38%16MITPHPPHP ^8.2CI passing

Since May 24Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/danielmrdev/laravel-spanish-validator)[ Packagist](https://packagist.org/packages/orumad/laravel-spanish-validator)[ Docs](https://github.com/danielmrdev/laravel-spanish-validator)[ RSS](/packages/orumad-laravel-spanish-validator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (9)Versions (19)Used By (0)

Laravel validator for spanish stuff: NIF, NIE, CIF, NSS, IBAN, Postal Code, Phone numbers
=========================================================================================

[](#laravel-validator-for-spanish-stuff-nif-nie-cif-nss-iban-postal-code-phone-numbers)

[![Latest Version on Packagist](https://camo.githubusercontent.com/efe0075d2f77a117a7d37846a91723852c7e269c1b91b2eecaab9ef826c78f29/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64616e69656c6d726465762f6c61726176656c2d7370616e6973682d76616c696461746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/danielmrdev/laravel-spanish-validator)[![Tests](https://github.com/danielmrdev/laravel-spanish-validator/actions/workflows/tests.yml/badge.svg)](https://github.com/danielmrdev/laravel-spanish-validator/actions)[![Code Quality](https://github.com/danielmrdev/laravel-spanish-validator/actions/workflows/quality.yml/badge.svg)](https://github.com/danielmrdev/laravel-spanish-validator/actions)[![Total Downloads](https://camo.githubusercontent.com/eb3b3769110fd47191f767f69af69c7012790ef63da7b2071ad6d1f16bd4971e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64616e69656c6d726465762f6c61726176656c2d7370616e6973682d76616c696461746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/danielmrdev/laravel-spanish-validator)

This package is a set of diferent validation rules for spanish national id numbers like:

- **NIF**: *"Número de Identificación Fiscal"* (tax number for individuals).
- **NIE**: *"Número de Idenfiticación para Extranjeros"* (identity number for foreigners).
- **CIF**: *"Código de Identificación Fiscal"* (tax number for companies).
- **NSS**: *"Número de la Seguridad Social"* (national security number).

Also the package include validators for:

- **IBAN**: International Bank Account Number.
- **Postal codes**: Spanish postal codes.
- **Phone number**: Spanish phone numbers format.

Installation
------------

[](#installation)

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"
```

### Migration from v1 (orumad/laravel-spanish-validator)

[](#migration-from-v1-orumadlaravel-spanish-validator)

**v2.0.0 is a major version with breaking changes:**

1. **Package name**: `orumad/laravel-spanish-validator` → `danielmrdev/laravel-spanish-validator`
2. **Namespace**: `Orumad\SpanishValidator` → `Danielmrdev\SpanishValidator`

**To 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.

Available rules
---------------

[](#available-rules)

- [`nif`](#nif)
- [`nie`](#nie)
- [`cif`](#cif)
- [`spanish_tax_number`](#spanish_tax_number)
- [`spanish_personal_id`](#spanish_personal_id)
- [`nss`](#nss)
- [`iban`](#iban)
- [`spanish_postal_code`](#spanish_postal_code)
- [`spanish_phone`](#spanish_phone)

### `nif`

[](#nif)

Determine if the input is a valid *"Número de Identificación Fiscal"* (tax number for individuals).

### `nie`

[](#nie)

Determine if the field under validation is a valid *"Número de Idenfiticación para Extranjeros"* (identity number for foreigners).

### `cif`

[](#cif)

This rule will validate if the input field is a valid *"Código de Identificación Fiscal"* (tax number for companies).

### `spanish_tax_number`

[](#spanish_tax_number)

This rule validates if the input is a valid spanish tax number: NIF or NIE or CIF.

### `spanish_personal_id`

[](#spanish_personal_id)

Will validate if the input is a valid personal id number in Spain (NIF or NIE).

### `nss`

[](#nss)

Determine if the field under validation is a valid "Número de la Seguridad Social"\_ (national security number).

### `iban`

[](#iban)

Test 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_code`

[](#spanish_postal_code)

Will check if the postal code is a valid spanish postal code.

### `spanish_phone`

[](#spanish_phone)

This tule validates if the input field content is a valid spanish phone number format.

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

61

—

FairBetter than 99% of packages

Maintenance88

Actively maintained with recent releases

Popularity40

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~207 days

Recently: every ~268 days

Total

13

Last Release

58d ago

Major Versions

1.4.5 → 2.0.02026-03-21

PHP version history (6 changes)1.0.0PHP ^7.2

1.0.3PHP ^7.2.5

1.1.2PHP ^7.3

1.2.0PHP ^7.4|^8.0

1.3.0PHP ^8.0|^8.1|^8.2

v1.4.0.x-devPHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/9031aae44312e0d3bdb635e3a51e922e5c3e5cda965a116db9280f6ad3f81aff?d=identicon)[danielmrdev](/maintainers/danielmrdev)

---

Top Contributors

[![enricv](https://avatars.githubusercontent.com/u/2940681?v=4)](https://github.com/enricv "enricv (5 commits)")[![danielmrdev](https://avatars.githubusercontent.com/u/17232506?v=4)](https://github.com/danielmrdev "danielmrdev (2 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![LorenzoRamalho](https://avatars.githubusercontent.com/u/4308861?v=4)](https://github.com/LorenzoRamalho "LorenzoRamalho (1 commits)")[![rubenmdh](https://avatars.githubusercontent.com/u/16972011?v=4)](https://github.com/rubenmdh "rubenmdh (1 commits)")

---

Tags

cifibanidentity-numberlaravelnienssphone-numberpostal-codesspanish-phonespanish-postaltax-numbervalidationvalidatorlaravellaravel-packagelaravel-validation-rulesCIFNIFlaravel-validatorNIEspanish validator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/orumad-laravel-spanish-validator/health.svg)

```
[![Health](https://phpackages.com/badges/orumad-laravel-spanish-validator/health.svg)](https://phpackages.com/packages/orumad-laravel-spanish-validator)
```

###  Alternatives

[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[ronanguilloux/isocodes

PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book and Music Industries, Phone numbers &amp; Zipcodes for many countries

8013.3M23](/packages/ronanguilloux-isocodes)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[laravel-validation-rules/credit-card

Validate credit card number, expiration date, cvc

2412.2M5](/packages/laravel-validation-rules-credit-card)[danielebarbaro/laravel-vat-eu-validator

A simple package that validates EU VAT numbers against the central ec.europa.eu database

37369.4k](/packages/danielebarbaro-laravel-vat-eu-validator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
