ddeboer / vatin
Validate VAT identification numbers
Fund package maintenance!
ddeboer
Installs: 2 243 615
Dependents: 8
Suggesters: 2
Security: 0
Stars: 136
Watchers: 14
Forks: 36
Open Issues: 4
Requires
- php: >=8.1
Requires (Dev)
- ext-soap: *
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.1
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^10.5
Suggests
- ext-soap: Required if you want to check the VAT number via VIES
README
A small PHP library for validating VAT identification numbers (VATINs).
Installation
This library is available on Packagist:
$ composer require ddeboer/vatin
If you want to use this library in a Symfony application, you can use the VatinBundle instead.
Usage
Validate a VAT number’s format:
use Ddeboer\Vatin\Validator; $validator = new Validator(); $bool = $validator->isValid('NL123456789B01');
Additionally check whether the VAT number is in use, with a call to the VAT Information Exchange System (VIES) SOAP web service:
use Ddeboer\Vatin\Validator; $validator = new Validator(); $bool = $validator->isValid('NL123456789B01', true);