evertharmeling/vat-client

Client library for the VIES/EU web service.

2.1.0 2021-11-17 08:48 UTC

This package is auto-updated.

Last update: 2024-11-17 15:06:16 UTC


README

Latest Stable Version Build Status

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.

Installation

composer require evertharmeling/vat-client

Usage

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
}

Roadmap

  • Formatter, add formatter who according to the regexes defined in the validator, formats the VAT number