zerochak / simple-vat-validator
Offline EU VAT number format and checksum validation for Laravel.
v1.1.0
2026-09-23 11:16 UTC
Requires
- php: ^8.2
- illuminate/contracts: ^10.0|^11.0|^12.0|^13.0
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0|^10.0|^11.0
- pestphp/pest: ^2.0|^3.0|^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Offline EU VAT number validation for Laravel: per-country format checks plus check-digit verification for Italy, Greece and Romania. It never calls VIES.
Installation
composer require zerochak/simple-vat-validator
Laravel auto-discovers the service provider. On Lumen, register it yourself:
$app->register(Chak\EuVatValidation\EuVatValidationServiceProvider::class);
Usage
Validation rule
use Chak\EuVatValidation\Rules\VatNumber; $request->validate([ 'vat' => ['required', new VatNumber('IT')], // validate against a country 'vat2' => ['nullable', new VatNumber()], // infer the country from the prefix (e.g. "DE123456789") ]);
Standalone
use Chak\EuVatValidation\Vat; Vat::isValid('IT00851670943'); // true Vat::isValid('00851670943', 'IT'); // true, since Italy and Lithuania accept numbers without a prefix Vat::isValid('EL997969920', 'GR'); // true, because GR is treated as an alias for VIES's EL Vat::supports('FR'); // true Vat::codes(); // ['AT', 'BE', ...]
Input is case-insensitive, and spaces are ignored.
Supported countries
AT, BE, BG, CY, CZ, DE, DK, EE, EL (GR), ES, FI, FR, GB, HR, HU, IE, IT, LT, LU, LV, MT, NL, PL, PT, RO, SE, SI, SK, SM
Translations
The package ships English and Italian messages. To customise them, publish the language files:
php artisan vendor:publish --tag=eu-vat-validation-lang
Testing
composer install vendor/bin/pest
License
MIT