Installation

This installation instruction assumes that you're using Symfony Flex. If you don't, take a look at the manual installation, but we strongly recommend using Flex for speed and simplicity.

Prerequisites

Before installing the plugin, ensure that your project:

  • Uses Sylius 2.x with Symfony Flex

  • Has Doctrine ORM and Twig properly configured

  • Uses Webpack Encore if customizing templates that require JavaScript assets

  • (Optional) Has the wkhtmltopdf binary installed for PDF generation

1. Enable Community Recipes

Allow Symfony to install community-contributed recipes:

composer config extra.symfony.allow-contrib true

2. Install the Plugin

Run the following command to add the plugin:

composer require sylius/invoicing-plugin

This command installs the plugin and applies the Symfony Flex recipe, registering necessary services and configuration automatically.

3. Run Migrations

The plugin includes database changes. Apply them with:

bin/console doctrine:migrations:migrate

If you're running in production:

bin/console doctrine:migrations:migrate -e prod

4. [Optional] Configure PDF Generation

To enable or disable PDF invoice generation, and configure save paths, add the following to your configuration:

# config/packages/sylius_invoicing.yaml
sylius_invoicing:
    pdf_generator:
        enabled: true
    invoice_save_path: '%kernel.project_dir%/var/invoices'

To set the path to wkhtmltopdf, export this in your environment:

export WKHTMLTOPDF_PATH=/usr/local/bin/wkhtmltopdf

5. [Optional] Generate Invoices for Existing Orders

If you want to generate invoices for orders placed before plugin installation:

bin/console sylius-invoicing:generate-invoices

6. Clear Cache

bin/console cache:clear

Result

After successful installation:

  • Invoices will be generated automatically based on configured order state transitions (default: created)

  • Admins and customers can download invoice PDFs

  • Invoices are accessible in the admin and linked to related orders

Last updated

Was this helpful?