PHPackages                             fidelo-software/vatrates - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. fidelo-software/vatrates

ActiveLibrary

fidelo-software/vatrates
========================

Up-to-date European VAT Rates

v2.3.3(4y ago)010MITPHPPHP &gt;5.3.3

Since Feb 17Pushed 4y agoCompare

[ Source](https://github.com/fidelo-software/vatrates)[ Packagist](https://packagist.org/packages/fidelo-software/vatrates)[ Docs](https://vatrates.fidelo.com)[ RSS](/packages/fidelo-software-vatrates/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (9)Used By (0)

VATRates
========

[](#vatrates)

*Up-to-date European VAT Rates*

[vatrates.nickstakenburg.com](http://vatrates.nickstakenburg.com)

VAT rates stored in `JSON` format, with [Javascript](#javascript) and [PHP](#php) classes for easy access.

Install
-------

[](#install)

#### Download

[](#download)

- [vatrates.min.js](https://unpkg.com/vatrates@2/dist/vatrates.min.js) minified
- [vatrates.js](https://unpkg.com/vatrates@2/dist/vatrates.js) un-minified

#### CDN

[](#cdn)

```

```

#### NPM

[](#npm)

```
npm install vatrates

```

#### Composer

[](#composer)

For the PHP package:

```
composer require staaky/vatrates

```

Javascript
----------

[](#javascript)

Require vatrates or use a script tag to include vatrates.js:

```
var vatRates = require('vatrates');
```

```

```

An instance created with `new VATRates()` gives you several VAT rate functions. It's recommended to always use an `isVATCountry()` check before using them, like this:

```
var VATRates = require('vatrates');

var vatRates = new VATRates();
if (vatRates.isVATCountry('RO')) {
    console.log(vatRates.getSuperReducedRate('RO')); // -> undefined
    console.log(vatRates.getReducedRates('RO'));     // -> [5, 9]
    console.log(vatRates.getStandardRate('RO'));     // -> 19
    console.log(vatRates.getParkingRate('RO'));      // -> undefined
}
```

Default rates are for today, to get rates for a different day pass in a `Date`:

```
var vatRates = new VATRates(new Date('2016-01-01'));
if (vatRates.isVATCountry('RO')) {
    console.log(vatRates.getStandardRate('RO')); // -> 20
}
```

You can also change the date by calling `setDate()` on a previously created instance:

```
var vatRates = new VATRates();
vatRates.setDate(new Date('2015-01-01'));
if (vatRates.isVATCountry('RO')) {
    console.log(vatRates.getStandardRate('RO')); // -> 24
}
```

### getCountry(countryCode)

[](#getcountrycountrycode)

Another approach is to use `getCountry()`, it returns a `VATCountry` or `undefined` if the country doesn't use VAT. With a VATCountry you'll have all the VAT rate functions and some extra helpers.

```
var vatRates = new VATRates();
var country;
if ((country = vatRates.getCountry('GB'))) {
    console.log(country.getName());             // -> "United Kingdom"
    console.log(country.getCode());             // -> "UK"
    console.log(country.getCountryCode());      // -> "GB"
    console.log(country.getSuperReducedRate()); // -> undefined
    console.log(country.getReducedRates());     // -> [5]
    console.log(country.getStandardRate());     // -> 20
    console.log(country.getParkingRate());      // -> undefined
}
```

The United Kingdom and Greece use extra non standard country codes "UK" and "EL", these are also accepted.

```
vatRates.getCountry('UK'); // -> same result as 'GB'
```

### getCountries()

[](#getcountries)

Returns an `Array` of all the countries using VAT, as `VATCountry`'s.

```
var vatRates = new VATRates();
var countries = vatRates.getCountries();

countries.forEach(function(country) {
  console.log(country.getCountryCode() + " has VAT: " + country.getStandardRate());
});
```

### setDate(date)

[](#setdatedate)

Set the `Date` for which to return VAT rates.

```
var vatRates = new VATRates();
vatRates.setDate(new Date('2015-01-01'));
```

This is identical to:

```
var vatRates = new VATRates(new Date('2015-01-01'));
```

> All other functions take this date into account, so make sure to always set the date first.

### isVATCountry(countryCode)

[](#isvatcountrycountrycode)

Returns `true` if a country uses VAT, or `false` if not.

```
var vatRates = new VATRates();
console.log(vatRates.isVATCountry('FR')); // -> true
console.log(vatRates.isVATCountry('US')); // -> false
```

### getSuperReducedRate(countryCode)

[](#getsuperreducedratecountrycode)

Returns the super reduced rate for a country, or `undefined` when none is available.

```
var vatRates = new VATRates();
if (vatRates.isVATCountry('FR')) {
  console.log(vatRates.getSuperReducedRate('FR')); // -> 2.1
});
```

A `VATCountry` returned by `getCountry()` offers this method directly.

```
var vatRates = new VATRates();
var country;
if ((country = vatRates.getCountry('FR'))) {
  console.log(country.getName());             // -> "France"
  console.log(country.getSuperReducedRate()); // -> 2.1
}
```

### getReducedRates(countryCode)

[](#getreducedratescountrycode)

Returns an `Array` of reduced rates for a country, or `undefined` when none are available.

```
var vatRates = new VATRates();
if (vatRates.isVATCountry('IE')) {
  console.log(vatRates.getReducedRates('IE')); // -> [9, 13.5]
});
```

A `VATCountry` offers this method directly.

```
var vatRates = new VATRates();
var country;
if ((country = vatRates.getCountry('IE'))) {
  console.log(country.getName());         // -> "Ireland"
  console.log(country.getReducedRates()); // -> [9, 13.5]
}
```

### getStandardRate(countryCode)

[](#getstandardratecountrycode)

Returns the standard rate for a country, or `undefined` when none is available.

```
var vatRates = new VATRates();
if (vatRates.isVATCountry('NL')) {
  console.log(vatRates.getStandardRate('NL')); // -> 21
});
```

A `VATCountry` offers this method directly.

```
var vatRates = new VATRates();
var country;
if ((country = vatRates.getCountry('NL'))) {
  console.log(country.getName());         // -> "Netherlands"
  console.log(country.getStandardRate()); // -> 21
}
```

### getParkingRate(countryCode)

[](#getparkingratecountrycode)

Returns the parking rate for a country, or `undefined` when none is available.

```
var vatRates = new VATRates();
if (vatRates.isVATCountry('LU')) {
  console.log(vatRates.getParkingRate('LU')); // -> 14
}
```

A `VATCountry` offers this method directly.

```
var vatRates = new VATRates();
var country;
if ((country = vatRates.getCountry('LU'))) {
  console.log(country.getName());        // -> "Luxembourg"
  console.log(country.getParkingRate()); // -> 14
}
```

PHP
---

[](#php)

After installing through Composer use `Staaky\VATRates\VATRates`

```
composer require staaky/vatrates

```

```
use Staaky\VATRates\VATRates;
```

An instance created with `new VATRates()` gives you several VAT rate functions. It's recommended to always use an `isVATCountry()` check before using them, like this:

```
$vatRates = new VATRates();
if ($vatRates->isVATCountry('RO')) {
    var_dump($vatRates->getSuperReducedRate('RO')); // -> null
    var_dump($vatRates->getReducedRates('RO'));     // -> [5, 9]
    var_dump($vatRates->getStandardRate('RO'));     // -> 19
    var_dump($vatRates->getParkingRate('RO'));      // -> null
}
```

Default rates are for today, to get rates for a different day pass in a `DateTime`:

```
$vatRates = new VATRates(new DateTime('2016-01-01'));
if ($vatRates->isVATCountry('RO')) {
    var_dump($vatRates->getStandardRate('RO')); // -> 20
}
```

You can also change the date by calling `setDate()` on a previously created instance:

```
$vatRates = new VATRates();
$vatRates->setDate(new DateTime('2015-01-01'));
if ($vatRates->isVATCountry('RO')) {
    var_dump($vatRates->getStandardRate('RO')); // -> 24
}
```

### getCountry(countryCode)

[](#getcountrycountrycode-1)

Another approach is to use `getCountry()`, it returns a `VATCountry` or `null` if the country doesn't use VAT. With a `VATCountry` you'll have all the VAT rate functions and some extra helpers.

```
$vatRates = new VATRates();
if (($country = $vatRates->getCountry('GB'))) {
    var_dump($country->getName());             // -> "United Kingdom"
    var_dump($country->getCode());             // -> "UK"
    var_dump($country->getCountryCode());      // -> "GB"
    var_dump($country->getSuperReducedRate()); // -> null
    var_dump($country->getReducedRates());     // -> [5]
    var_dump($country->getStandardRate());     // -> 20
    var_dump($country->getParkingRate());      // -> null
}
```

The United Kingdom and Greece use extra non standard country codes "UK" and "EL", these are also accepted.

```
$vatRates->getCountry('UK'); // -> same result as 'GB'
```

### getCountries()

[](#getcountries-1)

Returns an `array` of all the countries using VAT, as `VATCountry`'s.

```
$vatRates = new VATRates();
$countries = $vatRates->getCountries();

foreach ($countries as $country) {
  print_r($country->getCountryCode() . " has VAT: " . $country->getStandardRate() . "\n");
}
```

### setDate(DateTime $date)

[](#setdatedatetime-date)

Set the date for which to return VAT rates.

```
$vatRates = new VATRates();
$vatRates->setDate(new DateTime('2015-01-01'));
```

This is identical to:

```
$vatRates = new VATRates(new DateTime('2015-01-01'));
```

> All other functions take this date into account, so make sure to always set the date first.

### isVATCountry($countryCode)

[](#isvatcountrycountrycode-1)

Returns `true` if a country uses VAT, or `false` if not.

```
$vatRates = new VATRates();
var_dump($vatRates->isVATCountry('FR')); // -> true
var_dump($vatRates->isVATCountry('US')); // -> false
```

### getSuperReducedRate($countryCode)

[](#getsuperreducedratecountrycode-1)

Returns the super reduced rate for a country, or `null` if none is available.

```
$vatRates = new VATRates();
if ($vatRates->isVATCountry('FR')) {
  var_dump($vatRates->getSuperReducedRate('FR')); // -> 2.1
});
```

A `VATCountry` returned by `getCountry()` offers this method directly.

```
$vatRates = new VATRates();
if (($country = $vatRates->getCountry('FR'))) {
  var_dump($country->getName());             // -> "France"
  var_dump($country->getSuperReducedRate()); // -> 2.1
}
```

### getReducedRates($countryCode)

[](#getreducedratescountrycode-1)

Returns an `array` of reduced rates for a country, or `null` if none are available.

```
$vatRates = new VATRates();
if ($vatRates->isVATCountry('IE')) {
  var_dump($vatRates->getReducedRates('IE')); // -> [9, 13.5]
}
```

A `VATCountry` offers this method directly.

```
$vatRates = new VATRates();
if (($country = $vatRates->getCountry('IE'))) {
  var_dump($country->getName());         // -> "Ireland"
  var_dump($country->getReducedRates()); // -> [9, 13.5]
}
```

### getStandardRate($countryCode)

[](#getstandardratecountrycode-1)

Returns the standard rate for a country, or `null` when none is available.

```
$vatRates = new VATRates();
if ($vatRates->isVATCountry('NL')) {
  var_dump($vatRates->getStandardRate('NL')); // -> 21
});
```

A `VATCountry` offers this method directly.

```
$vatRates = new VATRates();
if (($country = $vatRates->getCountry('NL'))) {
  var_dump($country->getName());         // -> "Netherlands"
  var_dump($country->getStandardRate()); // -> 21
}
```

### getParkingRate($countryCode)

[](#getparkingratecountrycode-1)

Returns the parking rate for a country, or `null` when none is available.

```
$vatRates = new VATRates();
if ($vatRates->isVATCountry('LU')) {
  var_dump($vatRates->getParkingRate('LU')); // -> 14
});
```

A `VATCountry` offers this method directly.

```
$vatRates = new VATRates();
if (($country = $vatRates->getCountry('LU'))) {
  var_dump($country->getName());        // -> "Luxembourg"
  var_dump($country->getParkingRate()); // -> 14
}
```

Development
-----------

[](#development)

### Webpack

[](#webpack)

Use `webpack` to create a new build after you've made changes.

```
webpack

```

### Gulp

[](#gulp)

Use `gulp` to load up the page in the `/example` folder. It shows the output of all files (Javascript, JSON &amp; PHP) and automatically rebuilds with webpack as you modify source code.

```
gulp

```

### Unit Tests

[](#unit-tests)

Run unit tests using `npm test`, this runs tests for every language.

```
npm test

```

Javascript tests are run with [Mocha](https://mochajs.org) and PHP tests with [Peridot](http://peridot-php.github.io). They can be run individually as well:

```
npm run mocha

```

```
npm run peridot

```

Contribute
----------

[](#contribute)

VAT rates are kept up to date **manually** using data from the [European Commission](http://ec.europa.eu/taxation_customs/resources/documents/taxation/vat/how_vat_works/rates/vat_rates_en.pdf) and [VATLive.com](http://www.vatlive.com). Initial historic rates are based on data from [jsonvat.com](http://jsonvat.com).

If you notice an incorrect rate please [create an issue](https://github.com/staaky/vatrates/issues) or send a pull request. Future VAT changes can also be added to the `JSON` file. If you know of an upcoming change that isn't listed yet, please let me know.

Data on historic VAT rates is also appreciated. This can be hard to track down, especially the non-standard rates.

[![Flattr VATRates](https://camo.githubusercontent.com/7e3f46a36526479d701ef7f90a0f8c3ac2fbab3087446e2a9fceed75cd1ab802/687474703a2f2f6170692e666c617474722e636f6d2f627574746f6e2f666c617474722d62616467652d6c617267652e706e67)](https://flattr.com/submit/auto?user_id=staaky&url=http://vatrates.nickstakenburg.com&tags=github&category=software)

License
-------

[](#license)

VATRates is [MIT Licensed](https://raw.githubusercontent.com/staaky/vatrates/master/LICENSE)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 79.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~241 days

Recently: every ~252 days

Total

8

Last Release

1685d ago

PHP version history (2 changes)2.0.x-devPHP ^5.3.3 || ^7.0

v2.3.3PHP &gt;5.3.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/38d4634ecb82037de66b5607febac907ec43e9028749a3dab9dda0538bbb1925?d=identicon)[Fidelo Software GmbH](/maintainers/Fidelo%20Software%20GmbH)

---

Top Contributors

[![staaky](https://avatars.githubusercontent.com/u/5575?v=4)](https://github.com/staaky "staaky (34 commits)")[![DrMerk](https://avatars.githubusercontent.com/u/121562885?v=4)](https://github.com/DrMerk "DrMerk (3 commits)")[![gierschv](https://avatars.githubusercontent.com/u/396537?v=4)](https://github.com/gierschv "gierschv (2 commits)")[![mupat](https://avatars.githubusercontent.com/u/1731402?v=4)](https://github.com/mupat "mupat (2 commits)")[![fidelo-developer](https://avatars.githubusercontent.com/u/6771032?v=4)](https://github.com/fidelo-developer "fidelo-developer (1 commits)")[![njoerd114](https://avatars.githubusercontent.com/u/3825200?v=4)](https://github.com/njoerd114 "njoerd114 (1 commits)")

---

Tags

ratesvattaxeu

### Embed Badge

![Health badge](/badges/fidelo-software-vatrates/health.svg)

```
[![Health](https://phpackages.com/badges/fidelo-software-vatrates/health.svg)](https://phpackages.com/packages/fidelo-software-vatrates)
```

###  Alternatives

[mpociot/vat-calculator

EU VAT calculation, the way it should be.

1.3k3.9M18](/packages/mpociot-vat-calculator)[dragonbe/vies

EU VAT numbers validation using the VIES Service of the European Commission

2794.0M15](/packages/dragonbe-vies)[commerceguys/tax

Tax library with a flexible data model, predefined tax rates, powerful resolving logic.

286763.3k](/packages/commerceguys-tax)[ddeboer/vatin

Validate VAT identification numbers

1413.0M9](/packages/ddeboer-vatin)[ddeboer/vatin-bundle

Symfony bundle for the VATIN library

29884.1k](/packages/ddeboer-vatin-bundle)[sylius/taxation

Flexible taxation system for PHP ecommerce applications.

11385.3k7](/packages/sylius-taxation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
