Installation

This guide explains how to install and configure the Sylius Invoicing Plugin using Symfony Flex. If you're using a legacy Sylius setup without Symfony Flex, refer to the legacy instructions.

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

Enable Community Recipes

Allow Symfony to install community-contributed recipes:

composer config extra.symfony.allow-contrib true

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.

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

Configure PDF Generation (Optional)

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

(Optional) Generate Invoices for Existing Orders

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

bin/console sylius-invoicing:generate-invoices

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

Resources

Last updated

Was this helpful?