Description
vat.php is a simple PHP library which helps you to deal with European VAT rules. It helps you...
vat.php alternatives and similar libraries
Based on the "Miscellaneous" category.
Alternatively, view vat.php alternatives based on common mentions on social networks and blogs.
-
Country List
:globe_with_meridians: List of all countries with names and ISO 3166-1 codes in all languages and data formats. -
Essence
Extracts information about web pages, like youtube videos, twitter statuses or blog articles. -
sabre/vobject
:date: The VObject library for PHP allows you to easily parse and manipulate iCalendar and vCard objects -
Lodash-PHP
Easy to use utility functions for everyday PHP projects. This is a port of the Lodash JS library to PHP -
Embera
A Oembed consumer library, that gives you information about urls. It helps you replace urls to youtube or vimeo for example, with their html embed code. It has advanced features like offline support, responsive embeds and caching support. -
Metrics
Simple library that abstracts different metrics collectors. I find this necessary to have a consistent and simple metrics (functional) API that doesn't cause vendor lock-in. -
ClassPreloader
Optimizes class loading performance by generating a single PHP file containing all of the autoloaded files. -
Cake Utility
[READ-ONLY] CakePHP Utility classes such as Inflector, Text, Hash, Security and Xml. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp -
RedisSessionHandler
An alternative Redis session handler for PHP featuring per-session locking and session fixation protection -
Yell
PHP package to make your objects strict and throw exception when you try to access or set some undefined property in your objects.
CodeRabbit: AI Code Reviews for Developers
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of vat.php or a related project?
Popular Comparisons
README
ibericode/vat
This is a simple PHP library to help you deal with Europe's VAT rules.
- Fetch VAT rates for any EU member state using ibericode/vat-rates.
- Validate VAT numbers (by format and/or existence)
- Validate ISO-3316 alpha-2 country codes
- Determine whether a country is part of the EU
- Geo-locate IP addresses
Installation
PHP version 7.1 or higher with the CURL and JSON extension is required.
For VAT number existence checking, the PHP SOAP extension is required as well.
To get the latest stable version, install the package using Composer:
composer require ibericode/vat
Usage
This library exposes 4 main classes to interact with: Rates
, Countries
, Validator
and Geolocator
.
Retrieving VAT rates.
$rates = new Ibericode\Vat\Rates('/path-for-storing-cache-file.txt');
$rates->getRateForCountry('NL'); // 21
$rates->getRateForCountry('NL', 'standard'); // 21
$rates->getRateForCountry('NL', 'reduced'); // 9
$rates->getRateForCountryOnDate('NL', new \Datetime('2010-01-01'), 'standard'); // 19
This fetches rate from ibericode/vat-rates and stores a local copy that is periodically refreshed (once every 12 hours by default).
Validation
Validating a VAT number:
$validator = new Ibericode\Vat\Validator();
$validator->validateVatNumberFormat('NL203458239B01'); // true (checks format)
$validator->validateVatNumber('NL203458239B01'); // false (checks format + existence)
Validating an IP address:
$validator = new Ibericode\Vat\Validator();
$validator->validateIpAddress('256.256.256.256'); // false
$validator->validateIpAddress('8.8.8.8'); // true
Validating an ISO-3166-1-alpha2 country code:
$validator = new Ibericode\Vat\Validator();
$validator->validateCountryCode('DE'); // true
$validator->validateCountryCode('ZZ'); // false
Dealing with ISO-3166-1-alpha2 country codes
$countries = new Ibericode\Vat\Countries();
// access country name using array access
echo $countries['NL']; // Netherlands
// loop over countries
foreach ($countries as $code => $name) {
// ...
}
// check if country is in EU
$countries->isCountryCodeInEU('NL'); // true
$countries->isCountryCodeInEU('US'); // false
Geo-location
This library includes a simple geo-location service using ip2c.org or ip2country.info.
$geolocator = new Ibericode\Vat\Geolocator();
$geolocator->locateIpAddress('8.8.8.8'); // US
To use ip2country.info explicitly.
$geolocator = new Ibericode\Vat\Geolocator('ip2country.info');
$geolocator->locateIpAddress('8.8.8.8'); // US
Or, to use ip2c.org explicitly.
$geolocator = new Ibericode\Vat\Geolocator('ip2c.org');
$geolocator->locateIpAddress('8.8.8.8'); // US
Symfony support
If you need to use this package in a Symfony environment, check out ibericode/vat-bundle.
License
ibericode/vat is licensed under the [MIT License](LICENSE).
*Note that all licence references and agreements mentioned in the vat.php README section above
are relevant to that project's source code only.