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#
| Constant | Value | Description |
|---|---|---|
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#
| Method | Description |
|---|---|
->__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,
)| Parameter | Type | Description |
|---|---|---|
$timeout | int = 5 | |
$cacheTtl | int = 86400 | |
$http | (Closure(string, int): ?string)|null = null | returns the response body or null on failure |
supports()#
public static function supports(string $vatId): boolWhether VIES can check the VAT identifier (EU member state prefix incl. "EL", or "XI").
| Parameter | Type | Description |
|---|---|---|
$vatId | string |
- Returns
bool
verify()#
public function verify(string $vatId): VatIdVerification| Parameter | Type | Description |
|---|---|---|
$vatId | string |
- Returns
VatIdVerification