Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Nif Validator

Nif Validator Laravel Package

ulabox/nif-validator

A Laravel package for validating Spanish NIF, NIE and CIF tax identification numbers. It offers validation rules and simple helpers to verify document numbers in forms, requests and Eloquent models, making Spanish tax ID checks clean and reliable.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Nif Validator
How do I install and use ulabox/nif-validator in a Laravel app?
Run composer require ulabox/nif-validator and confirm that Laravel package auto-discovery registers the service provider. Then reference the package rule in a FormRequest rules() method or an inline $request->validate() call. Because the public repository metadata is limited, inspect the installed source and README to confirm the exact rule name and usage syntax before relying on it.
Which Laravel and PHP versions does ulabox/nif-validator support?
The package metadata does not publish a support matrix, so Laravel 10, 11, 12, and PHP 8.2+ compatibility must be confirmed from composer.json constraints and tested in your own CI. Do not assume current-framework support from the 2023 release date alone. Treat version verification as a first integration task.
Does ulabox/nif-validator validate NIF, NIE and CIF separately?
It is not clear from the available metadata whether NIF, NIE, and CIF are exposed as separate rules or as one combined validator. Read the rule class after installing to see which identifiers each rule accepts. Separate rules are preferable because they let you return precise error messages per document type.
How do I add the NIF validation rule to a Laravel FormRequest?
Add the package rule to your FormRequest rules() array in the same way as any custom validation rule, importing the rule class or using its alias if one is provided. Wrap the endpoint in a feature test with valid and invalid NIF, NIE, and CIF fixtures. Confirm the exact class name and constructor signature from the installed source before writing the request.
Can I validate Spanish tax IDs on Eloquent models with this package?
The package blurb mentions helpers for verifying document numbers in Eloquent models, but the exact model API is not documented in the metadata. Inspect the source for a trait, cast, or helper method before assuming how it attaches to a model. If no model integration exists, use the rule in a FormRequest and store the validated value on the model.
Does the validator handle NIE prefixes X, Y and Z correctly?
NIE numbers use X, Y, or Z prefixes followed by seven digits and a control letter, and this is a known edge case for Spanish tax ID validators. The package advertises NIE support, but the metadata does not show test coverage for these prefixes. Verify with fixtures for X, Y, and Z before trusting it on an onboarding or KYC path.
Is ulabox/nif-validator still actively maintained?
Signals point to low activity: a small star count and a last release in November 2023 with no evidence of an active cadence. Abandonment is plausible, so plan for the package as a small dependency you can replace rather than a long-term platform commitment. Re-check the issue tracker and release history before adopting it.
Does the package have tests for checksum edge cases like leading zeros and lowercase input?
The available metadata does not expose the test suite, changelog, or CI status, so test coverage of checksum algorithms and edge cases cannot be confirmed. Treat source review and your own fixture tests as mandatory. Cover leading zeros, lowercase input, whitespace, hyphens, and invalid control digits in both NIF and CIF cases.
What are the alternatives to ulabox/nif-validator for Spanish NIF, NIE and CIF validation?
Alternatives include ad-hoc regex and checksum validators inside FormRequests, small validation-rule libraries in the laravel/valitron style, and other Composer packages that target Spanish tax identifiers. Compare them on maintenance activity, declared Laravel and PHP support, and test coverage for NIF, NIE, and CIF edge cases. For a narrow rule like this, a well-tested in-house rule class is also a reasonable alternative.
Can I fork or vendor the rule into my own codebase if the package is abandoned?
Because the package is small, single-responsibility, and MIT-licensed, you can copy the rule class into app/Rules and remove the dependency if upstream goes dark. Do this behind feature tests so the in-house rule passes the same fixture set as the package. Keep the old integration path in a branch until parity is proven.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource