malek83 / polish-vat-payer
Library using Polish Ministry of Finance WebService to validate if given VAT Number is registered as VAT Tax Payer in Poland
Installs: 2 510
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.1.3
- ext-soap: *
- psr/log: ~1.1
- psr/simple-cache: ~1.0
Requires (Dev)
- desarrolla2/cache: ^3.0
- phpunit/phpunit: ^4.0 || ^5.0
- squizlabs/php_codesniffer: 3.*
This package is not auto-updated.
Last update: 2024-12-12 18:27:47 UTC
README
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.
Contents
Installation
This library is available on Packagist:
$ composer require malek83/polish-vat-payer
Usage
There are two easy ways to use this library:
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
to get the Full Response Object, containing all needed information
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)
By default cache is turned off. To use cache call the setter method during building the facade
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.
Request Log
Request log can be defined also. It's PSR-3 Compatible (i.e. Monolog)
By default it's turned off, to turn it on simply call setLogger
while building:
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.
Changelog
Please see CHANGELOG file for more information what has changed recently.
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.