Download the PHP package mistralys/vies-vat-service without Composer
On this page you can find all versions of the php package mistralys/vies-vat-service. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mistralys/vies-vat-service
More information about mistralys/vies-vat-service
Files in mistralys/vies-vat-service
Package vies-vat-service
Short Description Fetches data on a VAT number, and returns it as JSON.
License MIT
Informations about the package vies-vat-service
VIES VAT Service
Wrapper for the VIES VAT service, to fetch the data as JSON.
Fetching data
Sending a request
Simply call the endpoint with the vatid
parameter:
The request always returns JSON, with the status
key. This specifies
if the request itself was successful, not whether the VAT ID is valid.
Successful request
A successful request returns detailed data on the results. The relevant
part is stored under data > result
.
NOTE: The requester information is what has been specified in the service configuration, in the
config.php
.
From experience, the company name and address in the result set are missing more often than not, so it's better not to rely on it. The same goes for the requester match.
Failed request
A request can fail for example if the VIES VAT service is down. The error message details the reason why.
Parsing VAT ID strings
The static VatID::parse()
method accepts formatted and unformatted VAT ID strings. It automatically strips most commonly used separator characters and whitespace.
The following examples all return a valid VatID
instance:
Running the testsuite
To run the tests, first rename the tests/config.dist.php
to tests/config.php
, and fill out the necessary information to enable live tests against the VIES service.
Tests can be launched on Windows using run-tests.bat
. On linux, run the following command: