Skip to content

API reference / Quittio \ Core \ Validation \ Plausibility

ViesVerifier

final class in quittio/core · implements VatIdVerifier

Quittio\Core\Validation\Plausibility\ViesVerifier · Source

VAT identifier check via the REST interface of the EU VIES service.

Only identifiers of the EU member states (Greece: "EL") and of Northern Ireland ("XI") are sent to VIES; others are reported as not supported. Only the answers VALID and INVALID count as a result and are cached. Errors (INVALID_INPUT, MS_UNAVAILABLE, TIMEOUT, …) and unreachable services give $valid = null, are not cached and never block validation.

Constants#

ConstantValueDescription
ENDPOINT'https://ec.europa.eu/taxation_customs/vies/rest-api/ms/%s/vat/%s'
PREFIXES['AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'EL', 'ES', 'FI', 'FR', 'HR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK …

Methods#

MethodDescription
->__construct()
::supports()Whether VIES can check the VAT identifier (EU member state prefix incl. "EL", or "XI").
->verify()

__construct()#

public function __construct(
    int $timeout = 5,
    int $cacheTtl = 86400,
    (Closure(string, int): ?string)|null $http = null,
)
ParameterTypeDescription
$timeoutint = 5
$cacheTtlint = 86400
$http(Closure(string, int): ?string)|null = nullreturns the response body or null on failure

supports()#

public static function supports(string $vatId): bool

static

Whether VIES can check the VAT identifier (EU member state prefix incl. "EL", or "XI").

ParameterTypeDescription
$vatIdstring
Returns
bool

verify()#

public function verify(string $vatId): VatIdVerification
ParameterTypeDescription
$vatIdstring
Returns
VatIdVerification

The open core packages are MIT licensed. The legal wording of the country packs must be confirmed by a tax adviser.