PHPackages                             dannyvankooten/vat.php - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dannyvankooten/vat.php

Abandoned → [ibericode/vat](/?search=ibericode%2Fvat)Library[Utility &amp; Helpers](/categories/utility)

dannyvankooten/vat.php
======================

PHP library for dealing with EU VAT

2.1.2(2mo ago)443151.1k67[9 issues](https://github.com/ibericode/vat/issues)MITPHPPHP &gt;=8.2CI passing

Since Jan 16Pushed 2mo ago13 watchersCompare

[ Source](https://github.com/ibericode/vat)[ Packagist](https://packagist.org/packages/dannyvankooten/vat.php)[ RSS](/packages/dannyvankooten-vatphp/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (27)Used By (0)

ibericode/vat
=============

[](#ibericodevat)

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](https://github.com/ibericode/vat-rates).
- Validate VAT numbers (by format and/or [existence](http://ec.europa.eu/taxation_customs/vies/))
- Validate ISO-3316 alpha-2 country codes
- Determine whether a country is part of the EU
- Geo-locate IP addresses

Installation
------------

[](#installation)

[PHP](https://php.net) version 8.2 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](https://getcomposer.org):

```
composer require ibericode/vat
```

Usage
-----

[](#usage)

This library exposes 4 main classes to interact with: `Rates`, `Countries`, `Validator` and `Geolocator`.

#### Retrieving VAT rates.

[](#retrieving-vat-rates)

> This package relies on a [community maintained repository of vat rates](https://github.com/ibericode/vat-rates). We invite you to toggle notifications for that repository and contribute changes to VAT rates in your country once they are announced.

```
$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](https://github.com/ibericode/vat-rates) and stores a local copy that is periodically refreshed (once every 12 hours by default).

#### Validation

[](#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

[](#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

[](#geo-location)

This library includes a simple geo-location service using [ip2c.org](https://about.ip2c.org/) or [ip2country.info](https://ip2country.info) (deprecated as of Dec 2022).

```
$geolocator = new Ibericode\Vat\Geolocator();
$geolocator->locateIpAddress('8.8.8.8'); // US
```

To use ip2c.org explicitly.

```
$geolocator = new Ibericode\Vat\Geolocator('ip2c.org');
$geolocator->locateIpAddress('8.8.8.8'); // US
```

#### Symfony support

[](#symfony-support)

If you need to use this package in a [Symfony](https://symfony.com/) environment, check out [ibericode/vat-bundle](https://github.com/ibericode/vat-bundle).

License
-------

[](#license)

ibericode/vat is licensed under the [MIT License](LICENSE).

###  Health Score

66

—

FairBetter than 99% of packages

Maintenance85

Actively maintained with recent releases

Popularity49

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 73% 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 ~138 days

Recently: every ~159 days

Total

25

Last Release

75d ago

Major Versions

1.2.1 → 2.02019-02-11

1.2.2 → 2.0.102024-12-19

PHP version history (5 changes)1.0.0PHP &gt;=7.0

1.0.1PHP &gt;=5.6

1.2.0PHP &gt;=7.1

2.0.4PHP &gt;=7.3

2.0.10PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/d9ab986009a504dcfc4e1bb7b44f8f7f2586a5fda4303e9b51d5b32527ccc779?d=identicon)[dannyvankooten](/maintainers/dannyvankooten)

---

Top Contributors

[![dannyvankooten](https://avatars.githubusercontent.com/u/885856?v=4)](https://github.com/dannyvankooten "dannyvankooten (119 commits)")[![mixisLv](https://avatars.githubusercontent.com/u/3735128?v=4)](https://github.com/mixisLv "mixisLv (12 commits)")[![wiegandj](https://avatars.githubusercontent.com/u/122554692?v=4)](https://github.com/wiegandj "wiegandj (5 commits)")[![bpolaszek](https://avatars.githubusercontent.com/u/5569077?v=4)](https://github.com/bpolaszek "bpolaszek (4 commits)")[![VincentLanglet](https://avatars.githubusercontent.com/u/9052536?v=4)](https://github.com/VincentLanglet "VincentLanglet (3 commits)")[![franmomu](https://avatars.githubusercontent.com/u/720690?v=4)](https://github.com/franmomu "franmomu (3 commits)")[![Jarlskov](https://avatars.githubusercontent.com/u/392225?v=4)](https://github.com/Jarlskov "Jarlskov (2 commits)")[![holtkamp](https://avatars.githubusercontent.com/u/776405?v=4)](https://github.com/holtkamp "holtkamp (1 commits)")[![Kilbourne](https://avatars.githubusercontent.com/u/9169740?v=4)](https://github.com/Kilbourne "Kilbourne (1 commits)")[![malengrin](https://avatars.githubusercontent.com/u/216432?v=4)](https://github.com/malengrin "malengrin (1 commits)")[![MerelSollie](https://avatars.githubusercontent.com/u/50244687?v=4)](https://github.com/MerelSollie "MerelSollie (1 commits)")[![coenjacobs](https://avatars.githubusercontent.com/u/245703?v=4)](https://github.com/coenjacobs "coenjacobs (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")[![simonevallana](https://avatars.githubusercontent.com/u/16700043?v=4)](https://github.com/simonevallana "simonevallana (1 commits)")[![Swop](https://avatars.githubusercontent.com/u/545340?v=4)](https://github.com/Swop "Swop (1 commits)")[![trippo](https://avatars.githubusercontent.com/u/497169?v=4)](https://github.com/trippo "trippo (1 commits)")[![Ugoku](https://avatars.githubusercontent.com/u/3470653?v=4)](https://github.com/Ugoku "Ugoku (1 commits)")[![uldisn](https://avatars.githubusercontent.com/u/3525344?v=4)](https://github.com/uldisn "uldisn (1 commits)")[![dennisoderwald](https://avatars.githubusercontent.com/u/1653185?v=4)](https://github.com/dennisoderwald "dennisoderwald (1 commits)")[![BrekiTomasson](https://avatars.githubusercontent.com/u/7026735?v=4)](https://github.com/BrekiTomasson "BrekiTomasson (1 commits)")

---

Tags

euvatvat-numbervat-ratesvat

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/dannyvankooten-vatphp/health.svg)

```
[![Health](https://phpackages.com/badges/dannyvankooten-vatphp/health.svg)](https://phpackages.com/packages/dannyvankooten-vatphp)
```

###  Alternatives

[mpociot/vat-calculator

EU VAT calculation, the way it should be.

1.3k3.9M18](/packages/mpociot-vat-calculator)[commerceguys/tax

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

286763.3k](/packages/commerceguys-tax)[ibericode/vat-bundle

Bundle for using ibericode/vat in a Symfony environment

21254.5k](/packages/ibericode-vat-bundle)[iiifx-production/ukraine-identification-number

Ukraine Identification Number

117.3k](/packages/iiifx-production-ukraine-identification-number)

PHPackages © 2026

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