PHPackages                             antalaron/vat-number-validator - 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. antalaron/vat-number-validator

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

antalaron/vat-number-validator
==============================

PHP library to validate VAT numbers

v1.2.1(1y ago)670.0k↓25%7[2 issues](https://github.com/antalaron/vat-number-validator/issues)[1 PRs](https://github.com/antalaron/vat-number-validator/pulls)2MITPHP

Since Apr 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/antalaron/vat-number-validator)[ Packagist](https://packagist.org/packages/antalaron/vat-number-validator)[ RSS](/packages/antalaron-vat-number-validator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (10)Used By (2)

VAT number validator
====================

[](#vat-number-validator)

[![Build Status](https://camo.githubusercontent.com/5476931aca0c274f0681995c837595140d05c1e1bbc30a6c280e6ae920ddda9b/68747470733a2f2f7472617669732d63692e6f72672f616e74616c61726f6e2f7661742d6e756d6265722d76616c696461746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/antalaron/vat-number-validator) [![Coverage Status](https://camo.githubusercontent.com/c1cd8dbb7355f9b34acafd086742653680f4cada6b3848ebc0177378d8f82155/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f616e74616c61726f6e2f7661742d6e756d6265722d76616c696461746f722f62616467652e737667)](https://coveralls.io/github/antalaron/vat-number-validator?branch=master) [![Latest Stable Version](https://camo.githubusercontent.com/8970ab122a41a646b2b44ec54ff0641d694df7461ad4381d34e1614016350835/68747470733a2f2f706f7365722e707567782e6f72672f616e74616c61726f6e2f7661742d6e756d6265722d76616c696461746f722f762f737461626c65)](https://packagist.org/packages/antalaron/vat-number-validator) [![Latest Unstable Version](https://camo.githubusercontent.com/78c903a494461bb23fbb99e403ae23662f04ad1d1110677f0df1856fbff5659b/68747470733a2f2f706f7365722e707567782e6f72672f616e74616c61726f6e2f7661742d6e756d6265722d76616c696461746f722f762f756e737461626c65)](https://packagist.org/packages/antalaron/vat-number-validator) [![License](https://camo.githubusercontent.com/9f971907e9a044b914f0f6ac8519cb99563c7cf6deccda0e1525b9b1df456232/68747470733a2f2f706f7365722e707567782e6f72672f616e74616c61726f6e2f7661742d6e756d6265722d76616c696461746f722f6c6963656e7365)](https://packagist.org/packages/antalaron/vat-number-validator)

PHP library to validate VAT numbers.

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

[](#installation)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this library:

```
$ composer require antalaron/vat-number-validator
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

Basic usage
-----------

[](#basic-usage)

To validate a VAT number:

```
use Antalaron\Component\VatNumberValidator\VatNumber;
use Symfony\Component\Validator\Validation;

$validator = Validation::createValidator();
$violations = $validator->validate('ATU37675002', new VatNumber());

if (0 !== count($violations)) {
    foreach ($violations as $violation) {
        echo $violation->getMessage().'';
    }
}
```

You can add your own VAT validator via `extraVat` option:

```
$violations = $validator->validate('11', new VatNumber(['extraVat' => function ($number) {
    return 0 !== preg_match('/^(\d{2})$/', $number);
}]));
```

Origin
------

[](#origin)

This library is the PHP rewrite of [original JavaScript library](http://www.braemoor.co.uk/software/vat.shtml) by Braemoor Software Freebies. Original contributors are found [here](http://www.braemoor.co.uk/software/vatupdates.shtml).

License
-------

[](#license)

This library is under [MIT License](http://opensource.org/licenses/mit-license.php).

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~482 days

Recently: every ~701 days

Total

7

Last Release

425d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/464e80a7b766518129809bfb8ac8b22e8c51d274d66f2423d66520772413134c?d=identicon)[antalaron](/maintainers/antalaron)

---

Top Contributors

[![antalaron](https://avatars.githubusercontent.com/u/9386504?v=4)](https://github.com/antalaron "antalaron (18 commits)")[![vymak](https://avatars.githubusercontent.com/u/3403705?v=4)](https://github.com/vymak "vymak (2 commits)")[![hubipe](https://avatars.githubusercontent.com/u/617880?v=4)](https://github.com/hubipe "hubipe (1 commits)")[![proggeler](https://avatars.githubusercontent.com/u/18281353?v=4)](https://github.com/proggeler "proggeler (1 commits)")[![timwendisch](https://avatars.githubusercontent.com/u/19816873?v=4)](https://github.com/timwendisch "timwendisch (1 commits)")[![TNAJanssen](https://avatars.githubusercontent.com/u/2812277?v=4)](https://github.com/TNAJanssen "TNAJanssen (1 commits)")

---

Tags

phpvalidatorvat-numbervat-validator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/antalaron-vat-number-validator/health.svg)

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

###  Alternatives

[sllh/iso-codes-validator

Symfony validator wrapper of ronanguilloux/isocodes

37299.8k2](/packages/sllh-iso-codes-validator)[digitalrevolution/symfony-validation-shorthand

Validation shorthand for symfony

12108.5k2](/packages/digitalrevolution-symfony-validation-shorthand)[digitalrevolution/symfony-request-validation

Automatic request validation for symfony

1296.0k](/packages/digitalrevolution-symfony-request-validation)

PHPackages © 2026

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