This libray supports validating a vat number and getting the info about a taxable object. The library uses the http://www.controleerbtwnummer.nl/
API to retrieve the info and validation.
The http://www.controleerbtwnummer.nl/
API relies on the VIES/EU service and thus supports VAT numbers from all EU-countries.
composer require evertharmeling/vat-client
It's required to use a PSR-7 supported HTTPClient like guzzle
(^6.0) to inject in the Client
.
$client = new VIESApi\Client\Client(new GuzzleHttp\Client(), VIESApi\Parser\VATParser());
try {
$taxableObject = $client->getInfo('<VATNumber>');
var_dump($taxableObject);
catch (TaxableObjectNotFoundException $e) {
// VAT number not found
}
- Formatter, add formatter who according to the regexes defined in the validator, formats the VAT number