Skip to content

This library validate VAT numbers by using regular expressions and the VIES (VAT Information Exchange System) service.

License

Notifications You must be signed in to change notification settings

davidvandertuijn/vat-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

VAT Validator

Total Downloads Latest Stable Version License

VAT Validator

This VAT Number Validation library allows users to verify VAT numbers with high accuracy by leveraging both regular expressions and the VIES (VAT Information Exchange System) service. This dual-layer validation ensures that VAT numbers are correctly formatted and legally valid within the European Union.

"Buy Me A Coffee"

Install

composer require davidvandertuijn/vat-validator

Usage

use Davidvandertuijn\VatValidator\Validator as VatValidator;
$vatValidator = new VatValidator;

$vatValidator->validate('NL821783981B01'); // true

if ($vatValidator->isValid()) {
    $metaData = $vatValidator->getMetaData();
}
[
    "name" => "FLORO WEBDEVELOPMENT B.V.",
    "address" => "WESTBLAAK 00180 3012KN ROTTERDAM"
]

Strict

In this VAT Number Validation library, when strict mode is set to FALSE, the validation process is more flexible, especially in scenarios where the VIES (VAT Information Exchange System) service is temporarily unavailable. In such cases, the validation will return TRUE, allowing the workflow to continue without disruption due to service timeouts or SOAP errors.

$vatValidator->setStrict(false); // default = true

Cache

To optimize the validation process and reduce the dependency on the VIES (VAT Information Exchange System) service, we recommend caching valid VAT numbers within your application. This approach minimizes repeated requests to the VIES service and improves overall performance.

About

This library validate VAT numbers by using regular expressions and the VIES (VAT Information Exchange System) service.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages