PHP code example of richweber-technology / vatfyi-sdk-php

1. Go to this page and download the library: Download richweber-technology/vatfyi-sdk-php 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/ */

    

richweber-technology / vatfyi-sdk-php example snippets




use RichweberTechnology\vatfyi\Client;
use RichweberTechnology\vatfyi\components\Company;
use RichweberTechnology\vatfyi\components\VatNumber;

$client = new Client('YOUR_API_KEY');
$checker = new VatNumber($client);

$check = $checker->checkVatNumber('EE102001059');

echo $check . PHP_EOL;
echo $checker->isSuccess() . PHP_EOL;
echo $checker->isValidNumber() . PHP_EOL;
echo $checker->getErrorDescription() . PHP_EOL;

$company = $checker->getCompany();
if ($company instanceof Company) {
    echo $company->getCompanyName() . PHP_EOL;
    echo $company->getCountryCode() . PHP_EOL;
    echo $company->getCompanyAddress() . PHP_EOL;
    echo $company->getVatNumber() . PHP_EOL;
}

use RichweberTechnology\vatfyi\Client;
use RichweberTechnology\vatfyi\components\Amount;
use RichweberTechnology\vatfyi\components\RateDto;
use RichweberTechnology\vatfyi\components\VatRate;

$client = new Client('YOUR_API_KEY');

$dto = new RateDto('EE', 123.45);
$checker = new VatRate($client);

$check = $checker->getVatRate($dto);

echo $check . PHP_EOL;
echo $checker->isSuccess() . PHP_EOL;
echo $checker->isVatNumberConfirmed() . PHP_EOL;
echo $checker->isVatNumberFailed() . PHP_EOL;
echo $checker->getVatNumberFailDescription() . PHP_EOL;
echo $checker->getErrorDescription() . PHP_EOL;

$company = $checker->getAmount();
if ($company instanceof Amount) {
    echo $company->getVAT() . PHP_EOL;
    echo $company->getAmount() . PHP_EOL;
    echo $company->getVatAmount() . PHP_EOL;
    echo $company->getTotalAmount() . PHP_EOL;
}
bash
# Install Composer
curl -sS https://getcomposer.org/installer | php
bash
php composer.phar 
bash
php composer.phar update