PHP code example of tpweb / vat

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

    

tpweb / vat example snippets


"tpweb/vat": "^1.3"

composer 

TPWeb\Vat\VatServiceProvider::class,

'Vat' => TPWeb\Vat\VatFacade::class,

$vatnr = "BE....";
$vat = new Vat($vatnr);
if($vat->isVatValid()) {
    echo "VAT is valid!";
}

$this->validate($request, ['vatnumber' => 'vat']);

$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