PHPackages                             webgriffe/sylius-italian-invoiceable-order-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. [Payment Processing](/categories/payments)
4. /
5. webgriffe/sylius-italian-invoiceable-order-plugin

ActiveSylius-plugin[Payment Processing](/categories/payments)

webgriffe/sylius-italian-invoiceable-order-plugin
=================================================

Sylius plugin which allows Italian merchants to collect invoice data for their orders.

v2.0.1(2mo ago)467.3k↓47.3%3[3 issues](https://github.com/webgriffe/SyliusItalianInvoiceableOrderPlugin/issues)MITPHPPHP ^8.2CI passing

Since Aug 7Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/webgriffe/SyliusItalianInvoiceableOrderPlugin)[ Packagist](https://packagist.org/packages/webgriffe/sylius-italian-invoiceable-order-plugin)[ RSS](/packages/webgriffe-sylius-italian-invoiceable-order-plugin/feed)WikiDiscussions master Synced 1mo ago

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

 [ ![](https://camo.githubusercontent.com/83733a6117ae540c829d8f618763311d694365b0d8872928c13cffaf85301cf4/68747470733a2f2f73796c6975732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031382f30382f7765626772696666655f6c6f676f2e706e67) ](https://www.webgriffe.com)

Italian Invoiceable Order Plugin
================================

[](#italian-invoiceable-order-plugin)

[![](https://camo.githubusercontent.com/5b98e02f3693c16fd3f40037251d70ca5e1ecd2a11608dd21c9c7e3933b8942e/68747470733a2f2f73796c6975732e636f6d2f6173736574732f62616467652d617070726f7665642d62792d73796c6975732e706e67)](https://sylius.com/plugins/)

Sylius plugin which allows Italian merchants to collect invoice data for their orders such as tax code, VAT number, SDI code, etc... as well as allowing the merchant to only apply taxes to those customers that can (and must) pay taxes in advance.

[![Build Status](https://github.com/webgriffe/SyliusItalianInvoiceableOrderPlugin/workflows/Build/badge.svg)](https://github.com/webgriffe/SyliusItalianInvoiceableOrderPlugin/actions)

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

[](#installation)

1. Require the plugin:

    ```
    composer require webgriffe/sylius-italian-invoiceable-order-plugin
    ```
2. If they have not been added automatically, you have to add these bundles to `config/bundles.php` file:

    ```
        Webgriffe\SyliusItalianInvoiceableOrderPlugin\WebgriffeSyliusItalianInvoiceableOrderPlugin::class => ['all' => true],
    ```
3. Add the plugin's configs by creating the `config/packages/webgriffe_sylius_italian_invoiceable_order_plugin.yaml` file with the following content:

    ```
    imports:
        - { resource: "@WebgriffeSyliusItalianInvoiceableOrderPlugin/config/config.php" }
    ```
4. By default, the parameter `webgriffe_sylius_italian_invoiceable_order.taxation.eu_zone_code` is set to "EU", as it must be the code of a zone representing the EU. This is used to determine if an order is invoiced to a company within the EU or not. Please change this parameter according to your Sylius's zone configuration if needed:

    ```
    # config/services.yaml
    parameters:
        webgriffe_sylius_italian_invoiceable_order.taxation.eu_zone_code: 'EU' # Change it if needed
    ```
5. Your `Address` entity must implement the `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableAddressInterface` and the `Symfony\Component\Validator\GroupSequenceProviderInterface`. You can use the `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableAddressTrait` as implementation for both interfaces.
6. Your `Order` entity must implement the `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableOrderInterface`. You can use the `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableOrderTrait` as default implementation for the interface.
7. You need to import the `Address` and `Order` validator configuration into your project by copying the configuration files provided by this plugin:

    ```
    mkdir -p config/validator/
    cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/config/validation/Address.xml config/validator/
    cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/config/validation/Order.xml config/validator/
    ```

    **WAIT! We are not done with this step yet.** You must edit these files to change the namespace `Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin` to your own project namespace: there are 3 references that you have to change among these files.

    If you have the "App" as the base namespace of your app, this command should be enough:

    Linux:

    ```
    sed -i 's/Tests\\Webgriffe\\SyliusItalianInvoiceableOrderPlugin/App/g' config/validator/Address.xml config/validator/Order.xml
    ```

    MacOS:

    ```
    sed -i '' 's/Tests\\Webgriffe\\SyliusItalianInvoiceableOrderPlugin/App/g' config/validator/Address.xml config/validator/Order.xml
    ```

    If you already have some validator file for these entities you have to merge the configuration manually.

    *NB* Please, note that currently these validation rules are applied in strict mode. This means that if the VIES service is not available for some reason, the validation of the VAT number will fail. This could occur frequently on specific countries like Germany or France due to this problem: . If you want to avoid this strict behavior you can change the `strict` option of the `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Validator\Constraints\EuropeanVatNumber` constraint to `false` in the validation configuration file. This way, if the VIES service is not available, the VAT number will be considered valid and the checkout will not be blocked.
8. Configure Sylius to use the `Italian tax calculation` tax calculation strategy.
9. To properly enable group sequence validation of your Address entity you must set the `Default` validation group instead of the `sylius` validation group:

    ```
    # config/parameters.yaml
    parameters:
        # ...
        sylius.form.type.address.validation_groups: ['Default']
    ```

    For more information see [here](https://symfony.com/doc/current/validation/sequence_provider.html).
10. Run migration

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

11. Add invoiceable fields to the address show template for admin. To do so you have to override this template:

    ```
    vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/templates/shared/helper/address.html.twig
    ```

    by copying directly our implementation provided in the plugin:

    ```
    mkdir -p templates/bundles/SyliusAdminBundle/shared/helper/
    cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig
    ```

    or by copying the original template and adding the invoiceable fields by yourself. In this case your template should look like the following:

    ```
    {% macro address(address) %}

            {% include '@WebgriffeSyliusItalianInvoiceableOrderPlugin/shared/address/billingAddressInfo.html.twig' with { address } only %}
            {{ address.phoneNumber }}
            {{ address.street }}
            {{ address.city }}
            {% if address|sylius_province_name is not empty %}
                {{ address|sylius_province_name }}
            {% endif %}
            {{ address.countryCode|sylius_country_name|upper }} {{ address.postcode }}

    {% endmacro %}
    ```

Features
--------

[](#features)

Once installed this plugin will allow the users of the shop to enter all the invoicing information needed by an Italian company to properly invoice the order. In addition, this plugin checks the billing data of the order and uses them to decide whether the customer has to pay taxes or not.

This plugin will add the following fields to your address form:

- **Billing recipient type**, which allows the user to specify if the billing address is for a company or for an individual. This field will be required for every address used as the billing address for an order.
- **Tax code**, which in Italy is known as "*Codice Fiscale*". It's, more or less, like the social security number (SSN) in the US but in Italy both companies and individuals have a tax code. This field will be required for Italian individuals and companies and validated according the proper checksum algorithm.
- **VAT Number**, which in Italy is known as "*Partita IVA*". It's another identification number but for companies only not only in Italy but also in the EU. This field will be required for Italian companies and validated according the proper checksum algorithm. This field will be also required for EU companies and validated using the [EU's VIES service](https://ec.europa.eu/taxation_customs/vies/) using the [MyOnlineStore/ViesBundle](MyOnlineStore/ViesBundle).
- **SDI Code**, where SDI stands for "*Sistema Di Interscambio*". It's a code that is needed to be able to properly generate an "electronic invoice" which is mandatory in Italy since January the 1st of 2019. This field will be required for Italian companies and validated according the proper rules of the Italian IRS (called "*Agenzia delle Entrate*" in Italy).
- **PEC address**, where PEC stands for "*Posta Elettronica Certificata*" (the Italian translation of "certified email"). It's like an email address but for a special email type meant to provide a legal equivalent of the traditional mail. See [here](https://en.wikipedia.org/wiki/Certified_email) for more information. This field will not be required even for Italian companies, but if entered it must be a valid email address.

This plugin will also require the Sylius's *company* field to be populated if the billing recipient type is set to company.

This plugin also replaces the Sylius's `Sylius\Component\Addressing\Comparator\AddressComparatorInterface` implementation by decorating it and by comparing also invoiceable fields. So different invoiceable address information provided during checkout are saved in the customer address book as new addresses.

This plugin also allows to select an invoiceable address from the address book in the checkout and properly fill the address form with all the invoicing information.

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

[](#contributing)

To contribute you need to:

1. Clone this repository into you development environment and go to the plugin's root directory,
2. Then, from the plugin's root directory, run the following commands:

    ```
    composer install
    ```
3. Copy `tests/TestApplication/.env` in `tests/TestApplication/.env.local` and set configuration specific for your development environment.
4. Link node\_modules:

    ```
    ln -s vendor/sylius/test-application/node_modules node_modules
    ```
5. Run docker (create a `compose.override.yml` if you need to customize services):

    ```
    docker-compose up -d
    ```
6. Then, from the plugin's root directory, run the following commands:

    ```
    composer test-app-init
    ```
7. Run your local server:

    ```
    symfony server:ca:install
    symfony server:start -d
    ```
8. Now at  you have a full Sylius testing application which runs the plugin

### Static checks

[](#static-checks)

- Coding Standard

    ```
    vendor/bin/ecs check --fix
    ```
- Psalm

    ```
    vendor/bin/psalm
    ```
- PHPStan

    ```
    vendor/bin/phpstan analyse
    ```

### Testing

[](#testing)

After your changes you must ensure that the tests are still passing.

First setup your test database:

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

And build assets:

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

The current CI suite runs the following tests:

- PHPUnit

    ```
    vendor/bin/phpunit
    ```
- PHPSpec

    ```
    vendor/bin/phpspec run
    ```
- Behat (non-JS scenarios)

    ```
    vendor/bin/behat --strict --tags="~@javascript"
    ```
- Behat (JS scenarios)

    1. [Install Symfony CLI command](https://symfony.com/download).
    2. Start Headless Chrome:

    ```
    google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1
    ```

    3. Install SSL certificates (only once needed) and run test application's webserver on `127.0.0.1:8080`:

    ```
    symfony server:ca:install
    APP_ENV=test symfony server:start --port=8080 --dir=tests/TestApplication/public --daemon
    ```

    4. Run Behat:

    ```
    vendor/bin/behat --strict --tags="@javascript"
    ```

License
-------

[](#license)

This library is under the MIT license. See the complete license in the LICENSE file.

Credits
-------

[](#credits)

Developed by [Webgriffe®](http://www.webgriffe.com/).

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance69

Regular maintenance activity

Popularity35

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~149 days

Total

22

Last Release

82d ago

Major Versions

0.10.x-dev → v1.0.02026-01-16

v1.0.0 → v2.0.02026-02-10

v1.0.1 → v2.0.12026-02-26

PHP version history (5 changes)0.1.0PHP ^7.3

0.6.0PHP ^7.4 || ^8.0

0.8.0PHP ^8.0

0.11.0PHP ^8.1

v1.0.0PHP ^8.2

### Community

Maintainers

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

---

Top Contributors

[![mmenozzi](https://avatars.githubusercontent.com/u/1199914?v=4)](https://github.com/mmenozzi "mmenozzi (42 commits)")[![lruozzi9](https://avatars.githubusercontent.com/u/26346480?v=4)](https://github.com/lruozzi9 "lruozzi9 (39 commits)")[![LucaGallinari](https://avatars.githubusercontent.com/u/5822554?v=4)](https://github.com/LucaGallinari "LucaGallinari (36 commits)")[![azambon](https://avatars.githubusercontent.com/u/2920227?v=4)](https://github.com/azambon "azambon (31 commits)")[![fabianaromagnoli](https://avatars.githubusercontent.com/u/23638004?v=4)](https://github.com/fabianaromagnoli "fabianaromagnoli (4 commits)")

---

Tags

syliussyliussylius-plugintest-appication

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/webgriffe-sylius-italian-invoiceable-order-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/webgriffe-sylius-italian-invoiceable-order-plugin/health.svg)](https://phpackages.com/packages/webgriffe-sylius-italian-invoiceable-order-plugin)
```

###  Alternatives

[sylius/invoicing-plugin

Invoicing plugin for Sylius.

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

PayPal plugin for Sylius.

451.4M4](/packages/sylius-paypal-plugin)[flux-se/sylius-payum-stripe-plugin

Payum Stripe gateways plugin for Sylius.

61342.2k](/packages/flux-se-sylius-payum-stripe-plugin)[webgriffe/sylius-table-rate-shipping-plugin

Provides table rate shipping calculator.

1490.4k](/packages/webgriffe-sylius-table-rate-shipping-plugin)[bitbag/przelewy24-plugin

Przelewy24 payment plugin for Sylius applications.

1931.7k](/packages/bitbag-przelewy24-plugin)[bitbag/sylius-adyen-plugin

BitBag Adyen plug-in for Sylius.

1249.9k](/packages/bitbag-sylius-adyen-plugin)

PHPackages © 2026

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