Files
ws_vatcheck/vendor/ph-7/eu-vat-validator/example.php
T
isabelleandClaude Sonnet 5 0c1f7d4d1b Initial commit: ws_vatcheck at v1.0.3
Includes the fix for the GR/EL VAT prefix bug that broke exemption for
every Greek VAT number (in_array-on-values vs array_key_exists in
CacheTaxManager/VatNumber, plus the missing use import in
EuValidatorAdapter). Adds IMPROVEMENTS.txt with a checklist of features
adopted from comparing against the vatchecker module (offline-fallback
policy, failure logging, company-name check, configurable EU country
list, per-product exclusion, GB/XI mapping, AJAX live validation,
address-priority strategy).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-11 15:59:39 +02:00

28 lines
965 B
PHP

<?php
/**
* @author Pierre-Henry Soria <pierrehenrysoria@gmail.com>
* @copyright (c) 2017-2019, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; <https://www.gnu.org/licenses/gpl-3.0.en.html>
*/
require 'src/autoloader.php';
use PH7\Eu\Vat\Provider\Europa;
use PH7\Eu\Vat\Validator;
$oVatValidator = new Validator(new Europa, '0472429986', 'BE');
if ($oVatValidator->check()) {
$sRequestDate = $oVatValidator->getRequestDate();
// Optional, format the date
$sFormattedRequestDate = (new DateTime)->format('d-m-Y');
echo 'Business Name: ' . $oVatValidator->getName() . '<br />';
echo 'Address: ' . $oVatValidator->getAddress() . '<br />';
echo 'Request Date: ' . $sFormattedRequestDate . '<br />';
echo 'Member State: ' . $oVatValidator->getCountryCode() . '<br />';
echo 'VAT Number: ' . $oVatValidator->getVatNumber() . '<br />';
} else {
echo 'Invalid VAT number';
}