1. Go to this page and download the library: Download ddeboer/vatin-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ddeboer / vatin-bundle example snippets
// app/AppKernel.php
public function registerBundles()
{
return [
...
new Ddeboer\VatinBundle\DdeboerVatinBundle(),
...
];
}
use Ddeboer\VatinBundle\Validator\Constraints\Vatin;
class Company
{
/**
* @Vatin
*/
protected $vatNumber;
use Ddeboer\VatinBundle\Validator\Constraints\Vatin;
/**
* @Vatin(checkExistence=true)
*/
protected $vatNumber;
use Symfony\Component\Validator\Exception\ValidatorException;
try {
if ($validator->isValid()) {
// Happy flow
}
} catch (ValidatorException $e) {
// VAT could not be validated because VIES service is unreachable
}