Invoicing plugin for Sylius.
Installs: 524 240
Open Issues: 32
- php: ^8.0
- knplabs/knp-snappy-bundle: ^1.8
- ramsey/uuid: ^3.9 || ^4.0
- sylius/grid-bundle: ^1.7
- sylius/resource-bundle: ^1.6
- sylius/sylius: ~1.11.0 || ~1.12.0
- symfony/config: ^5.4 || ^6.0
- symfony/dependency-injection: ^5.4 || ^6.0
- symfony/form: ^5.4 || ^6.0
- symfony/framework-bundle: ^5.4 || ^6.0
- symfony/http-foundation: ^5.4 || ^6.0
- symfony/http-kernel: ^5.4 || ^6.0
- symfony/messenger: ^5.4 || ^6.0
- symfony/options-resolver: ^5.4 || ^6.0
- symfony/routing: ^5.4 || ^6.0
- behat/behat: ^3.6.1
- behat/mink-selenium2-driver: ^1.4
- friends-of-behat/exclude-specifications-extension: ^0.2 || ^0.3
- friends-of-behat/mink: ^1.8
- friends-of-behat/mink-browserkit-driver: ^1.3
- friends-of-behat/mink-debug-extension: ^2.0
- friends-of-behat/mink-extension: ^2.3
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.0
- friends-of-behat/symfony-extension: ^2.1
- friends-of-behat/variadic-extension: ^1.3
- matthiasnoback/symfony-config-test: ^4.0
- matthiasnoback/symfony-dependency-injection-test: ^4.1
- phpspec/phpspec: ^7.0
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: 0.12.96
- phpstan/phpstan-doctrine: 0.12.38
- phpstan/phpstan-symfony: 0.12.32
- phpstan/phpstan-webmozart-assert: 0.12.12
- phpunit/phpunit: ^8.5
- polishsymfonycommunity/symfony-mocker-container: ^1.0
- sylius-labs/coding-standard: ~4.0.0
- symfony/browser-kit: ^5.4 || ^6.0
- symfony/debug-bundle: ^5.4 || ^6.0
- symfony/dotenv: ^5.4 || ^6.0
- symfony/intl: ^5.4 || ^6.0
- symfony/web-profiler-bundle: ^5.4 || ^6.0
- symfony/webpack-encore-bundle: ^1.15
This package is auto-updated.
Last update: 2023-05-21 13:50:41 UTC
This plugin creates an invoice related to the order.
SyliusInvoicingPlugin creates new immutable invoice when the order is in given state (default: created) and allows both customer and admin to download invoices related to the order.
The primary aim of Invoicing Plugin is to create a document representing Customer's will to buy particular products and pay for them.
An Invoice can also be treated as a proof of placing an Order. Thus, it is downloadable as .pdf file and can be sent to Customer manually by the Administrator or automatically once an Order is paid.
Additional feature of the plugin that fulfills Invoicing domain is the ability to set billing data on a Seller.
Require plugin with composer:
composer require sylius/invoicing-plugin
Remember to allow community recipes with
composer config extra.symfony.allow-contrib trueor during plugin installation process
Apply migrations to your database:
Default configuration assumes enabled PDF file generation. If you don't want to use that feature change your app configuration:
# config/packages/sylius_invoicing.yaml sylius_invoicing: pdf_generator: enabled: false
Otherwise, check if you have wkhtmltopdf binary. If not, you can download it here.
In case wkhtmltopdf is not located in
WKHTMLTOPDF_PATHenvironment variable in the
WKHTMLTOPDF_PATH=/usr/local/bin/wkhtmltopdf # Change this! :)
If you want to generate invoices for orders placed before plugin's installation run the following command using your terminal:
This installation instruction assumes that you're using Symfony Flex. If you don't, take a look at the legacy installation instruction. However, we strongly encourage you to use Symfony Flex, it's much quicker! :)
Majority of actions contained in SyliusInvoicingPlugin is executed once an event after changing the state of
the Order on
winzou_state_machine is dispatched.
Here is the example:
winzou_state_machine: sylius_payment: callbacks: after: sylius_invoicing_plugin_payment_complete_producer: on: ['complete'] do: ['@sylius_invoicing_plugin.event_producer.order_payment_paid', '__invoke'] args: ['object']
Code placed above is a part of configuration placed in
You can customize this file by adding new state machine events listeners or editing existing ones.
Apart from that an Invoice model is treated as a Resource.
You can read more about Resources here:
Hence, template for displaying the list of Invoices is defined in
sylius_invoicing_plugin_invoice: resource: | alias: sylius_invoicing_plugin.invoice section: admin templates: "@SyliusAdmin\\Crud" only: ['index'] grid: sylius_invoicing_plugin_invoice permission: true vars: all: subheader: sylius_invoicing_plugin.ui.manage_invoices index: icon: inbox type: sylius.resource
Another aspect that can be both replaced and customized is displaying Invoices list on Order show view. Code responsible for displaying Invoices related to the Order is injected to existing Sylius template using Sonata events. You can read about customizing templates via events here:
By default, when the order is paid, an immutable Invoice pdf file is saved on the server. The save directory is specified
%sylius_invoicing.invoice_save_path% parameter, that can be overridden if needed.
There is no direct relation between
Sylius\InvoicingPlugin\Entity\Invoice entity and its file. It's resolved based on
Invoice::$number, which is defined in
By overriding this service, you can change a logic that is used to retrieve the invoice file.
You can add
ShopBillingData fixtures into a yaml to add Channel ShopBillingData info to your installation.
More instructions on the fixtures configuration instructions.
If you think that you have found a security issue, please do not use the issue tracker and do not post it publicly.
Instead, all security issues must be sent to