PHPackages                             eventix/eu-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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. eventix/eu-vat

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

eventix/eu-vat
==============

Eu VAT formatting and validation Laravel package

v1.0.1(6y ago)28MITPHPPHP ^7.2

Since Aug 28Pushed 6y ago2 watchersCompare

[ Source](https://github.com/Eventix/eu-vat)[ Packagist](https://packagist.org/packages/eventix/eu-vat)[ Docs](https://eventix.io/)[ RSS](/packages/eventix-eu-vat/feed)WikiDiscussions master Synced 2w ago

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

EU Vat
======

[](#eu-vat)

[![PHP Version](https://camo.githubusercontent.com/1add70048e3442966f051115f3f1f7e7c288b1394ee200ae36f8920f06ea4e8e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6576656e7469782f65752d766174)](https://php.net/)[![Laravel Version](https://camo.githubusercontent.com/03608be5b5668e2f7bccfd926754214f15c2784eb957459463922a55f579fb26/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d253545352e372d726564)](https://laravel.com/docs/5.7)[![License](https://camo.githubusercontent.com/3c6ae0d3905fcef70fd91b8744c48711aab0e1c8ce9b85c9bdd59b029f7631cc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4576656e7469782f65752d766174)](LICENSE)

This Laravel package enables the formatting and validation of (EU) VAT numbers.

For validation it uses the endpoints of the [European Commission's VAT Information Exchange Service (VIES)](http://ec.europa.eu/taxation_customs/vies/faq.html)

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [Testing](#Testing)
- [Contributing](#contributing)

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

[](#installation)

Via Composer

```
$ composer require eventix/eu-vat
```

Usage
-----

[](#usage)

When the package is included in a Laravel project, composer autoload functionality has automatically discovered a Service Provider. This will extend the Laravel Validator with a validation rule (vat\_number).

Also an alias for a Facade is registered. This facade (EuVat) will enable manual formatting and validation for vat numbers.

### Supported countries

[](#supported-countries)

```
EuVat::codes(): array; // List of supported country codes
EuVat::supports(string $countryCode): bool; // Determines if a given country code is supported
EuVat::name(string $countryCode): ?string; // Returns the (english) name associated with a country code if it is supported)
EuVat::inferCountry(string $vatNumber): ?string; // (Try to) guess the country of a vat number.
```

### Vat Numbers

[](#vat-numbers)

```
EuVat::format(string $vatNumber, ?string $countryCode = null): ?string // (Try to) format a vat number by the formatting rules of a given country, or a guessed country
EuVat::validate(string $vatNumber, ?string $countryCode = null): ?string // (Try to) validate a vat number by the formatting rules of a given country, or a guessed country
```

### Validator

[](#validator)

> Validates the vat number by inferring its country

```
$data = [
    'vat_nr' => 'NL123456789B01',
];

$validator = Validator::make($data, [
    'vat_nr' => 'required|vat_number',
]);
```

> Validates the vat number for a given country

```
$data = [
    'vat_nr' => 'NL123456789B01',
];

$validator = Validator::make($data, [
    'vat_nr' => 'required|vat_number:NL',
]);
```

> Validates the vat number for a country determined by another field

```
$data = [
    'country' => 'NL',
    'vat_nr' => 'NL123456789B01',
];

$validator = Validator::make($data, [
    'vat_nr' => 'required|vat_number:country',
]);
```

**Validation ONLY when the vat number changes**

*If the value does not change... it should already be valid. This will reduce the calls to VIES. Note: The validation rule needs the original value for this to work.*

> Validates a changed vat number for an inferred country

```
$data = [
    'vat_nr' => 'NL123456789B01',
];

$validator = Validator::make($data, [
    'vat_nr' => 'required|vat_number:NULL,NL123456789B01',
]);
```

> Validates a changed vat number for a country determined by another field

```
$data = [
    'country' => 'NL',
    'vat_nr' => 'NL123456789B01',
];

$validator = Validator::make($data, [
    'vat_nr' => 'required|vat_number:country,NL123456789B01',
]);
```

> Validates a changed vat number for a given country

```
$data = [
    'vat_nr' => 'NL123456789B01',
];

$validator = Validator::make($data, [
    'vat_nr' => 'required|vat_number:NL,NL123456789B01',
]);
```

Testing
-------

[](#testing)

Note, for testing the project needs to be cloned and all dependencies installed first.

```
$ cd /packages/directory
$ git clone git@github.com:Eventix/eu-vat.git
$ composer install
```

```
$ composer test
```

License
-------

[](#license)

Please see [License File](LICENSE).

No liability, implementor is responsible for reviewing code!

Issues
------

[](#issues)

Please [open an issue](https://github.com/eventix/eu-vat/issues/new).

Contributing
------------

[](#contributing)

Please contribute using [Github Flow](https://guides.github.com/introduction/flow/). Fork the project, create a branch, add commits, and [open a pull request](https://github.com/eventix/eu-vat/compare/).

Opportunities
-------------

[](#opportunities)

- Test coverage is not a 100% yet.

**Potentials**

- Opportunities for localized country names
- Opportunities for 3 char country codes
- Opportunities for country/ies outside the EU

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

2498d ago

PHP version history (2 changes)v1.0.0PHP ^7.3

v1.0.1PHP ^7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1905778?v=4)[Chris](/maintainers/Grisgruis)[@Grisgruis](https://github.com/Grisgruis)

---

Top Contributors

[![PeterDeKok](https://avatars.githubusercontent.com/u/10116718?v=4)](https://github.com/PeterDeKok "PeterDeKok (7 commits)")

---

Tags

vatvieslaravel-validation-ruleseueventix

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[dragonbe/vies

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

2814.2M17](/packages/dragonbe-vies)[ddeboer/vatin

Validate VAT identification numbers

1413.1M9](/packages/ddeboer-vatin)[ph-7/eu-vat-validator

A simple and clean PHP class that validates EU VAT numbers against the central ec.europa.eu database (using the official europa API).

97485.7k1](/packages/ph-7-eu-vat-validator)[drahosistvan/vatvalidation

A simple wrapper for VIES VAT Validation WebService.

13261.8k](/packages/drahosistvan-vatvalidation)

PHPackages © 2026

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