Validate a VAT number against the official European Commission VIES VAT number validation SOAP service.
- PHP version 7 and above.
- php7.x-soap extension
composer require "toxicdigital/vat-validator"
use Toxic\Validator\Vat as VatValidator;
$validator = VatValidator::getInstance();
//Returns true or false
$validator->isValid("XY123456789");
//If VAT number is valid, company info is available
$validator->getCompany();
/*
* Toxic\Validator\Vat\Company Object
* (
* [name] => John Doe
* [address] => 123 Main St, Anytown, UK
* [vatNumber] => 100
* [countryCode] => GB
* [valid] => true
* )
*/