#Installation
Require this package in your composer.json
and update composer.
"tpweb/vat": "^1.3"
Or
composer require tpweb/vat
After updating composer, add the ServiceProvider to the providers array in config/app.php
TPWeb\Vat\VatServiceProvider::class,
You can use the facade for shorter code. Add this to your aliases:
'Vat' => TPWeb\Vat\VatFacade::class,
$vatnr = "BE....";
$vat = new Vat($vatnr);
if($vat->isVatValid()) {
echo "VAT is valid!";
}
$this->validate($request, ['vatnumber' => 'vat']);
When the service is down a ServiceUnavailableException exception is thrown. To allow the validation to succeed when the service is down you can add an option with the default value when to the validation.
$this->validate($request, ['vatnumber' => 'vat:true']);
$vatnr = "BE....";
$vat = new Vat($vatnr);
echo $vat->vatFormat();
$generator = new Vat;
echo $generator->generateOGM(1); //Output: 000000000101
echo $generator->generateOGM(1, "111"); //Output: 111000000195
echo $generator->generateOGM(2, "333", true); //Output: 333/0000/00290
The complete documentation can be found at: http://www.tpweb.org/my-projects/php-vat-library/
Support github or mail: tjebbe.lievens@madeit.be
Please try to follow the psr-2 coding style guide. http://www.php-fig.org/psr/psr-2/
This package is licensed under LGPL. You are free to use it in personal and commercial projects. The code can be forked and modified, but the original copyright author should always be included!