florowebdevelopment / vat-validator
VAT Validator
Installs: 5 278
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.0.0
README
This package is deprecated and will not be maintained.
VAT Validator
This library validate VAT numbers by using regular expressions and the VIES (VAT Information Exchange System) service.
Install
composer require florowebdevelopment/vat-validator
Usage
use Florowebdevelopment\VatValidator\VatValidator;
$oVatValidator = new VatValidator;
$oVatValidator->validate('NL821783981B01'); // true
if ($oVatValidator->isValid()) {
$aMetaData = $oVatValidator->getMetaData();
/*
array(
"name" => "FLORO WEBDEVELOPMENT B.V.",
"address" => "WESTBLAAK 00180 3012KN ROTTERDAM"
)
*/
}
Strict (optional)
When strict is set to FALSE, the VAT number validation returns TRUE if the VIES service is not available (CURL timeout or SoapFault).
$oVatValidator->setStrict(false); // default = true
Comments
We suggest that you cache the valid VAT numbers in your application to prevent multiple requests to the VIES service.