PHPackages                             laraben/vat - 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. laraben/vat

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

laraben/vat
===========

PHP library for dealing with EU VAT

2.0.7(4y ago)048MITPHPPHP &gt;=7.3

Since Jan 16Pushed 3y agoCompare

[ Source](https://github.com/laraben/vat)[ Packagist](https://packagist.org/packages/laraben/vat)[ RSS](/packages/laraben-vat/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (2)Versions (18)Used By (0)

laraben/vat
===========

[](#larabenvat)

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](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 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](https://getcomposer.org):

```
composer require laraben/vat
```

Usage
-----

[](#usage)

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

#### Retrieving VAT rates.

[](#retrieving-vat-rates)

```
$rates = new Laraben\Vat\Rates('/path-for-storing-cache-file.txt');
$rates->getRatesForCountry('NL'); // array with different rates
$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 Laraben\Vat\Validator();
$validator->validateVatNumberFormat('NL203458239B01'); // true (checks format)
$validator->validateVatNumber('NL203458239B01'); // false (checks format + existence)
```

Validating an IP address:

```
$validator = new Laraben\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 Laraben\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 Laraben\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).

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

To use ip2country.info explicitly.

```
$geolocator = new Laraben\Vat\Geolocator('ip2country.info');
$geolocator->locateIpAddress('8.8.8.8'); // US
```

Or, to use ip2c.org explicitly.

```
$geolocator = new Laraben\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 environment, check out [Ibericode/vat-bundle](https://github.com/Laraben/vat-bundle).

License
-------

[](#license)

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

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~101 days

Recently: every ~110 days

Total

17

Last Release

1775d ago

Major Versions

1.2.1 → 2.02019-02-11

PHP version history (4 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

### Community

Maintainers

![](https://www.gravatar.com/avatar/62f13b84f80292f5ceb7a5125e3d368490a0173420d5df637406e200c6721fd7?d=identicon)[LARABEN](/maintainers/LARABEN)

---

Top Contributors

[![dannyvankooten](https://avatars.githubusercontent.com/u/885856?v=4)](https://github.com/dannyvankooten "dannyvankooten (64 commits)")[![bpolaszek](https://avatars.githubusercontent.com/u/5569077?v=4)](https://github.com/bpolaszek "bpolaszek (4 commits)")[![laraben](https://avatars.githubusercontent.com/u/34068668?v=4)](https://github.com/laraben "laraben (2 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)")[![Swop](https://avatars.githubusercontent.com/u/545340?v=4)](https://github.com/Swop "Swop (1 commits)")[![coenjacobs](https://avatars.githubusercontent.com/u/245703?v=4)](https://github.com/coenjacobs "coenjacobs (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)")[![mixisLv](https://avatars.githubusercontent.com/u/3735128?v=4)](https://github.com/mixisLv "mixisLv (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")[![dixonl90](https://avatars.githubusercontent.com/u/557333?v=4)](https://github.com/dixonl90 "dixonl90 (1 commits)")

---

Tags

vat

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/laraben-vat/health.svg)

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

###  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)
