hantless / simple-vat
Simple package to check European's VAT number format
Installs: 21
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/hantless/simple-vat
Requires
Requires (Dev)
- orchestra/testbench: *
- phpunit/phpunit: ^4.0|^5.0
This package is auto-updated.
Last update: 2025-12-08 12:38:09 UTC
README
Laravel Simple VAT is a small library to check format of European VAT number.
It's mainly a curated version of the Laravel VAT package, removing the SOAP call for existence.
Installation
Simply require the project using Composer:
$ composer require hantless/simple-vat
Once Simple VAT is installed, you need to register the service provider. Open up config/app.php and add the following to
the providers key.
Hantless\SimpleVat\SimplevatServiceProvider::class
Or if you're using Laravel 5.5+, it should auto discover the package.
Usage
Use the validation rule "vat_format" in your formRequest:
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'vatnumberfield' => 'vat_format', ]; }
or in your validator:
public function store(Request $request) { $validator = Validator::make($request->all(), [ 'vatnumberfield' => 'vat_format', ]); if ($validator->fails()) { // redirect ... display error } // store entity... }
Add the error message in your translation files (resources/lang/{lang}/validation.php)
'vat_format' => 'The :attribute do not seem to be a valid VAT number',
License
Laravel Simple VAT is licensed under The MIT License(MIT).