, (*1)
Polish VAT Payer
Simple library using Polish Ministry of Finance WebService to validate
if given VAT Number is registered as VAT Tax Payer in Poland., (*2)
Contents
Installation
This library is available on Packagist:, (*3)
$ composer require malek83/polish-vat-payer
Usage
There are two easy ways to use this library:, (*4)
to get the boolean result of verification
use Malek83\PolishVatPayer\Builder\PolishVatPayerBuilder;
use Malek83\PolishVatPayer\PolishVatPayer;
/** @var PolishVatPayer $validator */
$validator = PolishVatPayerBuilder::builder()->build();
$bool = $validator->isValid('1568255600'); //returns boolean
use Malek83\PolishVatPayer\Builder\PolishVatPayerBuilder;
use Malek83\PolishVatPayer\PolishVatPayer;
/** @var PolishVatPayer $validator */
$validator = PolishVatPayerBuilder::builder()->build();
/** @var \Malek83\PolishVatPayer\Result\PolishVatNumberVerificationResult $result */
$result = $validator->validate('1234567890');
var_dump($result->isValid()); // gives boolean, true if company is VAT Payer, otherwise false
var_dump($result->getVatNumber()); //gives string, the verificated VAT number
var_dump($result->getMessage()); //gives string, the human readable message
Request cache
Request cache can be used if necessary. Any PSR-16 Compatible component can be used (i.e. symfony/cache), (*5)
By default cache is turned off. To use cache call the setter method during building the facade, (*6)
use Malek83\PolishVatPayer\Builder\PolishVatPayerBuilder;
use Malek83\PolishVatPayer\PolishVatPayer;
/** @var PolishVatPayer $validator */
$validator = PolishVatPayerBuilder::builder()
->setCache(new AnyPsr16CompatibleCache())
->setTtl(new DateInterval('PT1H'))
->build();
Default TTL is 1 hour. It can be also overriden while during the build process., (*7)
Request Log
Request log can be defined also. It's PSR-3 Compatible (i.e. Monolog), (*8)
By default it's turned off, to turn it on simply call setLogger
while building:, (*9)
use Malek83\PolishVatPayer\Builder\PolishVatPayerBuilder;
use Malek83\PolishVatPayer\PolishVatPayer;
/** @var PolishVatPayer $validator */
$validator = PolishVatPayerBuilder::builder()
->setLogger(new AnyPsr3CompatibleLogger())
->build();
Roadmap
All future features are listed in Roadmap GitHub project., (*10)
Changelog
Please see CHANGELOG file for more information what has changed recently., (*11)
Local environment for development & testing
$ docker build -t polish-vat-payer ./docker/
$ docker run -d --name polish-vat-payer --volume ${PWD}:/source polish-vat-payer
License
The MIT License (MIT). Please see License for more information., (*12)