PHP code example of ibericode / vat-bundle

1. Go to this page and download the library: Download ibericode/vat-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/ */

    

ibericode / vat-bundle example snippets


Ibericode\Vat\Bundle\VatBundle::class => ['all' => true]

use Ibericode\Vat\Countries;
use Ibericode\Vat\Validator;
use Ibericode\Vat\Rates;
use Ibericode\Vat\Geolocator;

class MyController 
{
    /**
     * Type-hint the class on your service constructors to retrieve a class instance
     */
    public function __construct(
        Rates $rates, 
        Validator $validator,
        Countries $countries, 
        Geolocator $geolocator
        )
    {
        $rates->getRateForCountry('NL'); // 21.00
        $validator->validateVatNumber('NL123456789B01'); // false
        $countries->isCountryCodeInEU('US') // false
        $geolocator->locateIpAddress('8.8.8.8'); // US
    }
}

use Ibericode\Vat\Bundle\Validator\Constraints\VatNumber;

class Customer 
{
    /**
    * @VatNumber() 
    */
    public $vatNumber;
}