PHPackages                             danielebarbaro/laravel-vat-eu-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. danielebarbaro/laravel-vat-eu-validator

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

danielebarbaro/laravel-vat-eu-validator
=======================================

A simple package that validates EU VAT numbers against the central ec.europa.eu database

v3.0.0(2mo ago)37369.4k↓15.4%16[3 PRs](https://github.com/danielebarbaro/laravel-vat-eu-validator/pulls)MITPHPPHP ^8.2

Since Feb 5Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/danielebarbaro/laravel-vat-eu-validator)[ Packagist](https://packagist.org/packages/danielebarbaro/laravel-vat-eu-validator)[ Docs](https://github.com/danielebarbaro/laravel-vat-eu-validator)[ GitHub Sponsors](https://github.com/danielebarbaro)[ RSS](/packages/danielebarbaro-laravel-vat-eu-validator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (22)Versions (33)Used By (0)

Laravel VAT EU VALIDATOR
========================

[](#laravel-vat-eu-validator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/79ad0bfa6304071f6f5cd23eaefe95058477d368a2cc08f3a017aad1e1cd65fd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64616e69656c656261726261726f2f6c61726176656c2d7661742d65752d76616c696461746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/danielebarbaro/laravel-vat-eu-validator)[![GitHub Tests Action Status](https://camo.githubusercontent.com/d9716fd387ff33e5912e166e45b9accc4a51878ae2c877fb4cc4a3f02be2ef63/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f64616e69656c656261726261726f2f6c61726176656c2d7661742d65752d76616c696461746f722f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/danielebarbaro/laravel-vat-eu-validator/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/cb62ed07e2eacfb80a22fc4e5588d4fa5b6a121611e58a4d203abe6bde099e53/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f64616e69656c656261726261726f2f6c61726176656c2d7661742d65752d76616c696461746f722f436865636b2532302532362532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/danielebarbaro/laravel-vat-eu-validator/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/1d9722fdb6a53b104cf14a96850b3abd9879d7237bde808242eca8720121db76/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64616e69656c656261726261726f2f6c61726176656c2d7661742d65752d76616c696461746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/danielebarbaro/laravel-vat-eu-validator)

laravel-vat-eu-validator is a package inspired from [vat.php](https://github.com/dannyvankooten/vat.php) to validate a VAT number for businesses based in Europe.

#### For Laravel 10, 11, 12 use tag 3.x

[](#for-laravel-10-11-12-use-tag-3x)

#### For Laravel 10, 11, 12 use tag 2.x (legacy SOAP-only)

[](#for-laravel-10-11-12-use-tag-2x-legacy-soap-only)

#### For Laravel 8, 9 use tag 1.20

[](#for-laravel-8-9-use-tag-120)

#### For Laravel 5, 6, 7 use tag 0.5.4

[](#for-laravel-5-6-7-use-tag-054)

What's new in v3.0
------------------

[](#whats-new-in-v30)

- **REST Client support**: an alternative to the traditional SOAP client, using the official European Commission REST APIs
- **Strategy Pattern architecture**: ViesClientInterface interface with ViesSoapClient and ViesRestClient implementations
- **Publishable configuration file**: choose which client to use and configure its parameters
- **Restructured test suite**: separation between unit and functional tests
- **PHP 8.4 e 8.5 support**

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

[](#installation)

You can install the package via composer:

```
composer require danielebarbaro/laravel-vat-eu-validator
```

The package will automatically register itself.

Configuration
-------------

[](#configuration)

### VIES Client Configuration

[](#vies-client-configuration)

The package supports multiple VIES clients for VAT validation:

- **SOAP Client** (default): Uses the traditional SOAP API
- **REST Client**: Uses the modern REST API

To customize the client configuration, publish the configuration file:

```
php artisan vendor:publish --tag=laravel-vat-eu-validator-config
```

This will create a `config/vat-validator.php` file where you can configure which client to use:

```
