PHPackages                             gewebe/sylius-vat-plugin - 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. gewebe/sylius-vat-plugin

ActiveSylius-plugin[Validation &amp; Sanitization](/categories/validation)

gewebe/sylius-vat-plugin
========================

VAT number address field with validation, EU VAT rates plugin for Sylius

v2.1.0(7mo ago)924.3k—8%1MITPHPPHP ^8.2CI failing

Since Jan 6Pushed 6mo ago2 watchersCompare

[ Source](https://github.com/gewebe/SyliusVATPlugin)[ Packagist](https://packagist.org/packages/gewebe/sylius-vat-plugin)[ RSS](/packages/gewebe-sylius-vat-plugin/feed)WikiDiscussions 2.1 Synced 1mo ago

READMEChangelog (10)Dependencies (32)Versions (20)Used By (0)

Sylius VAT number and rates plugin
==================================

[](#sylius-vat-number-and-rates-plugin)

[![Latest Version on Packagist](https://camo.githubusercontent.com/95f5634e476fa18ad6e528a5fb6d70b1b003a88b508264c75d5291e70b1a84d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6765776562652f73796c6975732d7661742d706c7567696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gewebe/sylius-vat-plugin)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build](https://github.com/gewebe/SyliusVATPlugin/actions/workflows/build.yml/badge.svg)](https://github.com/gewebe/SyliusVATPlugin/actions/workflows/build.yml)[![Quality Score](https://camo.githubusercontent.com/db18d3e58a462e9bcd15314a6eaa4d8657444456ff96422e88835e8542f21cad/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6765776562652f53796c697573564154506c7567696e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/gewebe/SyliusVATPlugin)

Features
--------

[](#features)

- Installer for EU VAT rates with countries and zones
- New fields for VAT number at `Address` and `ShopBillingData` entity
- Configure VAT number field requirement:
    - Optional / Required
    - Required if customer filled “Company” field
    - Required in selected countries
- Validate VAT number:
    - Format for selected country
    - Country is same as selected country
    - Validity using [VIES API](http://ec.europa.eu/taxation_customs/vies/) for EU VAT number
- Revalidate customers VAT numbers after a given time
- Placing an order without VAT in the EU, if
    - VAT number validation was successful
    - Customers taxation country is different from shop billing country

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

[](#installation)

### Download the plugin via composer

[](#download-the-plugin-via-composer)

```
composer require gewebe/sylius-vat-plugin
```

### Enable the plugin in bundles.php

[](#enable-the-plugin-in-bundlesphp)

```
# config/bundles.php

return [
    # ...

    Gewebe\SyliusVATPlugin\GewebeSyliusVATPlugin::class => ['all' => true],
];
```

### Import the plugin configurations

[](#import-the-plugin-configurations)

```
# config/packages/_sylius.yaml

imports:
    # ...

    - { resource: '@GewebeSyliusVATPlugin/config/config.yaml'}
```

### Configure taxation address

[](#configure-taxation-address)

For EU VAT, the address for taxation should be set to the shipping address in the Sylius configuration.

```
# config/packages/_sylius.yaml

sylius_core:
    shipping_address_based_taxation: true
```

### Copy templates

[](#copy-templates)

Copy customized templates to your templates directory (e.g `templates/bundles/`):

```
mkdir -p templates/bundles/SyliusAdminBundle/
cp -R vendor/gewebe/sylius-vat-plugin/templates/SyliusAdminBundle/* templates/bundles/SyliusAdminBundle/
mkdir -p templates/bundles/SyliusShopBundle/
cp -R vendor/gewebe/sylius-vat-plugin/templates/SyliusShopBundle/* templates/bundles/SyliusShopBundle/
```

### Extend `Address` entity

[](#extend-address-entity)

```
# src/Entity/Addressing/Address.php

namespace App\Entity\Addressing;

use Doctrine\ORM\Mapping as ORM;
use Gewebe\SyliusVATPlugin\Entity\VatNumberAddressInterface;
use Gewebe\SyliusVATPlugin\Entity\VatNumberAwareTrait;
use Sylius\Component\Core\Model\Address as BaseAddress;

/**
 * @ORM\Entity
 * @ORM\Table(name="sylius_address")
 */
#[ORM\Entity]
#[ORM\Table(name: 'sylius_address')]
class Address extends BaseAddress implements VatNumberAddressInterface
{
    use VatNumberAwareTrait;
```

If you use `yaml` mapping add also:

```
# config/doctrine/Address.orm.yaml

App\Entity\Addressing\Address:
    type: entity
    table: sylius_address
    fields:
        vatNumber:
            type: string
            column: vat_number
            nullable: true
        vatValid:
            type: boolean
            column: vat_valid
        vatValidatedAt:
            type: datetime
            column: vat_validated_at
            nullable: true
```

### Add or Extend `ShopBillingData` entity

[](#add-or-extend-shopbillingdata-entity)

```
# src/Entity/Channel/ShopBillingData.php

namespace App\Entity\Channel;

use Doctrine\ORM\Mapping as ORM;
use Gewebe\SyliusVATPlugin\Entity\ShopBillingDataVatNumberAwareTrait;
use Gewebe\SyliusVATPlugin\Entity\ShopBillingDataVatNumberInterface;
use Sylius\Component\Core\Model\ShopBillingData as BaseShopBillingData;

/**
 * @ORM\Entity
 * @ORM\Table(name="sylius_shop_billing_data")
 */
#[ORM\Entity]
#[ORM\Table(name: 'sylius_shop_billing_data')]
class ShopBillingData extends BaseShopBillingData implements ShopBillingDataVatNumberInterface
{
    use ShopBillingDataVatNumberAwareTrait;
```

If you use `yaml` mapping add also:

```
# config/doctrine/ShopBillingData.orm.yaml

App\Entity\Channel\ShopBillingData:
    type: entity
    table: sylius_shop_billing_data
    fields:
        vatNumber:
            type: string
            column: vat_number
            nullable: true
```

Override the resource for `shop_billing_data` in your sylius config:

```
# config/packages/_sylius.yaml

sylius_core:
    resources:
        shop_billing_data:
            classes:
                model: App\Entity\Channel\ShopBillingData
```

### Update your database schema

[](#update-your-database-schema)

```
bin/console doctrine:migrations:diff
bin/console doctrine:migrations:migrate
```

Usage
-----

[](#usage)

### Install EU countries and VAT rates

[](#install-eu-countries-and-vat-rates)

```
# EU VAT on digital services (MOSS scheme)
bin/console vat:install:eu

# EU with French VAT (cross-border)
bin/console vat:install:eu FR

# EU with French VAT and passed threshold in Spain and Portugal (cross-border)
bin/console vat:install:eu FR -t ES,PT

# EU with French VAT included in price
bin/console vat:install:eu FR -i

# EU with German standard and reduced VAT categories
bin/console vat:install:eu DE -c standard,reduced
```

### Validate customers VAT number

[](#validate-customers-vat-number)

##### 1. Create new order with VAT number at shipping address

[](#1-create-new-order-with-vat-number-at-shipping-address)

[![Screenshot checkout address with vat number](docs/images/checkout_address.png)](docs/images/checkout_address.png)

##### 2. Show VAT number and validation status at admin orders

[](#2-show-vat-number-and-validation-status-at-admin-orders)

[![Screenshot order shipping address with vat number](docs/images/admin_order_address.png)](docs/images/admin_order_address.png)

Testing
-------

[](#testing)

### Traditional

[](#traditional)

1. From the plugin skeleton root directory, run the following commands:

    ```
    (cd vendor/sylius/test-application && yarn install)
    (cd vendor/sylius/test-application && yarn build)
    vendor/bin/console assets:install

    vendor/bin/console doctrine:database:create
    vendor/bin/console doctrine:migrations:migrate -n
    # Optionally load data fixtures
    vendor/bin/console sylius:fixtures:load -n
    ```

To be able to set up a plugin's database, remember to configure your database credentials in `tests/TestApplication/.env` and `tests/TestApplication/.env.test`.

2. Run your local server:

    ```
    symfony server:ca:install
    symfony server:start -d
    ```
3. Open your browser and navigate to `https://localhost:8000`.

### Docker

[](#docker)

1. Execute `make init` to initialize the container and install the dependencies.
2. Execute `make database-init` to create the database and run migrations.
3. (Optional) Execute `make load-fixtures` to load the fixtures.
4. Your app is available at `http://localhost`.

Usage
-----

[](#usage-1)

### Running plugin tests

[](#running-plugin-tests)

- PHPUnit

    ```
    vendor/bin/phpunit
    ```
- Behat (non-JS scenarios)

    ```
    vendor/bin/behat --strict --tags="~@javascript&&~@mink:chromedriver"
    ```
- PHPStan - Static Analysis

    ```
    vendor/bin/phpstan analyse -c phpstan.neon -l max src/
    ```

    - Coding Standard

        ```
        vendor/bin/ecs check
        ```

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance65

Regular maintenance activity

Popularity33

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity78

Established project with proven stability

 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 ~110 days

Recently: every ~43 days

Total

20

Last Release

227d ago

Major Versions

1.4.x-dev → 2.0.x-dev2025-04-20

PHP version history (6 changes)v1.0.0-rc1PHP ^7.2

v1.0.0PHP ^7.3

v1.2.1PHP ^7.4 || ^8.0

v1.2.2PHP ^8.0

v1.4.2PHP ^8.1

2.0.x-devPHP ^8.2

### Community

Maintainers

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

---

Top Contributors

[![gewebe](https://avatars.githubusercontent.com/u/24402916?v=4)](https://github.com/gewebe "gewebe (83 commits)")

---

Tags

eu-vat-numbereu-vat-ratessyliussymfonysyliuse-commercevatsylius-plugin

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/gewebe-sylius-vat-plugin/health.svg)

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

###  Alternatives

[sylius/invoicing-plugin

Invoicing plugin for Sylius.

901.0M2](/packages/sylius-invoicing-plugin)[sylius/refund-plugin

Plugin provides basic refunds functionality for Sylius application.

691.7M14](/packages/sylius-refund-plugin)[sylius/price-history-plugin

Implementation of the Omnibus Directive for Sylius application.

1140.5k](/packages/sylius-price-history-plugin)

PHPackages © 2026

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