Laravel Validators
Validation rules for regional IDs, tax numbers and IBANs.
composer require devix-labs/laravel-validators
Live demo coming soon
Validation rules for IBAN, European VAT, Emirates ID, UAE TRN, Saudi ID and VAT, Qatar ID, Kuwait Civil ID, Bahrain CPR, Oman civil number, CNIC, NTN, PAN and GSTIN. Every result carries a reason code, the cleaned value, the formatted value and whether a check digit was actually verified — and 224 shared vectors assert that PHP answers exactly as the JavaScript package does, so a form and its server never disagree.
What you get
Rules that read like Laravel
'iban:AE,SA', 'vat:DE', 'emirates_id', or a rule object with ->only() and ->country().
Messages from the reason
“That IBAN has a digit wrong” rather than “invalid” — translatable like any Laravel language file.
Agrees with the browser
224 shared vectors, generated from the JavaScript package, asserted on every run — same reason code, same cleaned value, same formatting.
Honest about the check
Checked::Checksum or Checked::Structure on every result, because a UAE TRN has no check digit to verify.
Framework-free core
The validators are plain PHP classes; the Laravel rules are a thin layer on top.
Laravel Validators — overview
Why it exists
A form validates an Emirates ID in the browser with one regular expression and on the server with another. They disagree, and the difference is a support ticket.
This package is the PHP half of one set of rules. The JavaScript package generates the test vectors; this one is checked against them, so "valid" means the same thing on both sides — including why a number was refused.
What it does
- The same answers. 224 shared vectors, asserted on every run.
- Reason codes, as messages.
bad-checksumbecomes "that IBAN has a digit wrong — check it against your statement", in a language file you can translate or replace. - Rules that read like Laravel.
'iban:AE,SA','vat:DE','emirates_id', or a rule object with a fluent API. - Honest about the check.
Checked::ChecksumorChecked::Structureon every result.
Not in 1.0
VIES and FTA lookups (they need a network), and a Rule::unique-style database check.
How it compares
Questions
Do I need the JavaScript package too?
No, but together they are the point: the same rules in the form and on the server, asserted to agree by the shared vectors.
How do I change the messages?
php artisan vendor:publish --tag=validators-lang, then edit them like any Laravel language file. An application that defines its own validation.emirates_id keeps that wording.
What should I store in the database?
$result->value — the cleaned form with separators removed — and show $result->formatted. The docs include a cast that does both.
Does it work without Laravel?
Yes. Devix\Validators\Validators::check() is plain PHP with no framework dependency; the service provider only adds the rules and the messages.
More from Devix
All resources →Laravel Phone
Laravel package
Phone validation, casts and a Blade component that agree with Phone Input exactly.
Laravel Cookie Consent
Laravel package
Consent banner middleware with a proof-of-consent log.
Invoice PDF
Laravel package
VAT-ready invoice PDFs with Arabic and Urdu support.