composer require sandwave-io/vat
$vatService = new \SandwaveIo\Vat\Vat;
$vatService->validateEuropeanVatNumber("YOURVATNUMBERHERE", "COUNTRYCODE"); // true
$vatService->countryInEurope('NL'); // true
$vatService->europeanVatRate("COUNTRYCODE"); // 0.0
Feel free to create a PR if you have any ideas for improvements. Or create an issue.
- When adding code, make sure to add tests for it (phpunit).
- Make sure the code adheres to our coding standards (use php-cs-fixer to check/fix).
- Also make sure PHPStan does not find any bugs.
vendor/bin/php-cs-fixer fix
vendor/bin/phpstan analyze
vendor/bin/phpunit --coverage-text
These tools will also run in GitHub actions on PR's and pushes on master.
There is also an integration test, in order to skip this (heavy) test, run:
vendor/bin/phpunit --exclude=large
We generate coverage in PHPUnit. On the CI we use XDebug to do that. If you have XDebug installed, you can run:
vendor/bin/phpunit --coverage-text
# or generate an interactive report.
vendor/bin/phpunit --coverage-html=coverage_report
Alternatively, you can use PHPDBG as coverage driver:
phpdbg -qrr vendor/bin/phpunit --coverage-text