Sylius CLI Commands

Sylius provides several CLI commands in the sylius namespace. This page introduces the available commands and explains their usage.

List available commands

Because Sylius is built on Symfony, it provides the same CLI commands. Run them from your project root with ./bin/console. You can display the available Sylius-specific commands by listing all commands and grepping for “sylius” with ./bin/console list | grep sylius

 sylius
  sylius:admin-user:change-password          Change password of admin user
  sylius:admin-user:create                   Create a new admin user
  sylius:cancel-unpaid-orders                Removes order that have been unpaid for a configured period. Configuration parameter - sylius_order.order_expiration_period.
  sylius:debug:grid                          Debug grid configuration
  sylius:debug:mailer                        Debug email messages
  sylius:debug:resource                      Debug resource metadata.
  sylius:fixtures:list                       Lists available fixtures
  sylius:fixtures:load                       Loads fixtures from given suite
  sylius:inform-about-gus                    Informs about Sylius internal statistical service.
  sylius:install                             Installs Sylius in your preferred environment.
  sylius:install:assets                      Installs all Sylius assets.
  sylius:install:check-requirements          Checks if all Sylius requirements are satisfied.
  sylius:install:database                    Install Sylius database.
  sylius:install:jwt-setup                   Setup JWT token.
  sylius:install:sample-data                 Install sample data into Sylius.
  sylius:install:setup                       Sylius configuration setup.
  sylius:payment:generate-key                Generate a key for Sylius payment encryption.
  sylius:price-history:clear                 Clears the price history up to a given number of days ago
  sylius:promotion:generate-coupons          Generates coupons for a given promotion
  sylius:remove-expired-carts                Removes carts that have been idle for a period set in `sylius_order.expiration.cart` configuration key.
  sylius:show-plus-info                      Shows information about Sylius Plus and Sylius Store
  sylius:theme:assets:install                Installs themes web assets under a public web directory
  sylius:theme:list                          Shows list of detected themes.
  sylius:user:demote                         Demotes a user by removing a role.
  sylius:user:promote                        Promotes a user by adding roles.

sylius:admin-user:change-password

Description

Changes the password for an administrator account for the sylius admin.

Usage

./bin/console sylius:admin-user:change-password

You will then be prompted to enter the email address of the admin account and the new password.

Note: For security reasons, the password is not visible when you enter it.


sylius:admin-user:create

Description

Creates a new admin user for the Sylius admin.

Usage

./bin/console sylius:admin-user:create

You will then be prompted for the email address, first name, last name, password, locale code, and whether to enable the admin account.

Note: For security reasons, the password is not visible when you enter it.


sylius:cancel-unpaid-orders

Description

Removes order that have been unpaid for a configured period. Configuration parameter - sylius_order.order_expiration_period.

Usage

./bin/console sylius:cancel-unpaid-orders

sylius:debug:grid

Description

Debug grid configuration.

Usage

./bin/console sylius:debug:grid [<grid>]

If no argument for the grid is given, all configured grids will be shown.

Arguments

Argument
Description
Example Argument

grid

The name or fully-qualified class name (FQCN) of the grid to debug

name example: sylius_admin_product FQCN example: App\Grid\SupplierGrid

Output

If no argument is specified, it will output a list with all configured grids that are available.

 Which grid do you want to debug?:
  [0] sylius_admin_address_log_entry
  [1] sylius_admin_admin_user
  [2] sylius_admin_catalog_promotion
  [3] sylius_admin_channel
  [4] sylius_admin_channel_pricing_log_entry
  [5] sylius_admin_country
  [6] sylius_admin_currency
  [7] sylius_admin_customer
  [8] sylius_admin_customer_group
  [9] sylius_admin_customer_order
  [10] sylius_admin_exchange_rate
  [11] sylius_admin_inventory
  [12] sylius_admin_locale
  [13] sylius_admin_order
  [14] sylius_admin_payment
  [15] sylius_admin_payment_method
  [16] sylius_admin_payment_request
  [17] sylius_admin_product
  [18] sylius_admin_product_association_type
  [19] sylius_admin_product_attribute
  [20] sylius_admin_product_option
  [21] sylius_admin_product_review
  [22] sylius_admin_product_taxon
  [23] sylius_admin_product_variant
  [24] sylius_admin_product_variant_with_catalog_promotion
  [25] sylius_admin_promotion
  [26] sylius_admin_promotion_coupon
  [27] sylius_admin_shipment
  [28] sylius_admin_shipping_category
  [29] sylius_admin_shipping_method
  [30] sylius_admin_tax_category
  [31] sylius_admin_tax_rate
  [32] sylius_admin_taxon
  [34] sylius_admin_zone
  [35] sylius_shop_account_order
  [36] sylius_shop_product

Example Output

In this example we output the grid configuration for the sylius_admin_currency grid.

Definition of "sylius_admin_currency" Grid
==========================================

 --------------------- ----------------------------------------------------------------------
  Option                Value
 --------------------- ----------------------------------------------------------------------
  code                  "sylius_admin_currency"
  driver                "doctrine/orm"
  driverConfiguration   [
                          "class" => "App\Entity\Currency\Currency"
                        ]
  provider              null
  sorting               [
                          "code" => "asc"
                        ]
  limits                [
                          10,
                          25,
                          50
                        ]
  fields                [
                          "code" => Sylius\Component\Grid\Definition\Field^ {
                            -name: "code"
                            -type: "twig"
                            -path: "code"
                            -label: "sylius.ui.code"
                            -enabled: true
                            -sortable: "code"
                            -options: [
                              "template" => "@SyliusAdmin/shared/grid/field/code.html.twig",
                              "vars" => [
                                "th_class" => "w-1 text-center"
                              ]
                            ]
                            -position: 100
                          },
                          "name" => Sylius\Component\Grid\Definition\Field^ {
                            -name: "name"
                            -type: "string"
                            -path: "name"
                            -label: "sylius.ui.name"
                            -enabled: true
                            -sortable: null
                            -options: []
                            -position: 100
                          }
                        ]
  filters               [
                          "code" => Sylius\Component\Grid\Definition\Filter^ {
                            -name: "code"
                            -type: "string"
                            -label: "sylius.ui.code"
                            -enabled: true
                            -template: null
                            -options: []
                            -formOptions: []
                            -criteria: null
                            -position: 100
                          }
                        ]
  actionGroups          [
                          "main" => Sylius\Component\Grid\Definition\ActionGroup^ {
                            -name: "main"
                            -actions: [
                              "create" => Sylius\Component\Grid\Definition\Action^ {
                                -name: "create"
                                -type: "create"
                                -label: null
                                -enabled: true
                                -template: null
                                -icon: null
                                -options: []
                                -position: 100
                              }
                            ]
                          }
                        ]
 --------------------- ----------------------------------------------------------------------

If you would like to learn more about Grids in Sylius, checkout the grid bundle documentation.


sylius:debug:mailer

Description

Debug email messages.

Usage

./bin/console sylius:debug:mailer [<codeOfEmail>]

If no argument for the email code is given, all configured email messages will be shown.

Arguments

Argument
Description
Example Argument

codeOfEmail

Expected email to be shown identified by its code

admin_password_reset

Output

Emails
------

+------------------------------+----------------------------------------------------+---------+-----------------------------------------------+
| Code                         | Template                                           | Enabled | Subject                                       |
+------------------------------+----------------------------------------------------+---------+-----------------------------------------------+
| admin_password_reset         | @SyliusCore/Email/adminPasswordReset.html.twig     | yes     | sylius.emails.admin_password_reset.subject    |
| order_confirmation           | @SyliusShop/email/order_confirmation.html.twig     | yes     | sylius.emails.order_confirmation.subject      |
| user_registration            | @SyliusShop/email/user_registration.html.twig      | yes     | sylius.emails.user_registration.subject       |
| shipment_confirmation        | @SyliusAdmin/email/shipment_confirmation.html.twig | yes     | sylius.emails.shipment_confirmation.subject   |
| shipment_confirmation_resent | @SyliusCore/Email/shipmentConfirmation.html.twig   | yes     | sylius.emails.shipment_confirmation.subject   |
| password_reset               | @SyliusShop/email/password_reset.html.twig         | yes     | sylius.emails.user.password_reset.subject     |
| account_verification_token   | @SyliusCore/Email/accountVerification.html.twig    | yes     | sylius.emails.user.verification_token.subject |
| account_verification         | @SyliusCore/Email/accountVerification.html.twig    | yes     | Email address verification                    |
| contact_request              | @SyliusShop/email/contact_request.html.twig        | yes     | sylius.emails.contact_request.subject         |
| reset_password_token         | @SyliusShop/email/password_reset.html.twig         | yes     | sylius.emails.user.password_reset.subject     |
| verification_token           | @SyliusShop/email/verification.html.twig           | yes     | sylius.emails.user.verification_token.subject |
| order_confirmation_resent    | @SyliusCore/Email/orderConfirmation.html.twig      | yes     | sylius.emails.order_confirmation.subject      |
+------------------------------+----------------------------------------------------+---------+-----------------------------------------------+

Sender
------

 ------- ----------------------
  Name    Example.com
  Email   [email protected]
 ------- ----------------------

If you would like to learn more about E-Mails in Sylius, checkout the e-mail documentation.


sylius:debug:resource

Description

Debug resource metadata.

Usage

./bin/console sylius:debug:resource [options] [--] [<resource> [<operation>]

If no argument is given, the list of all project resources will be provided.

When a resource is given, it outputs metadata specific to that resource.

Arguments

Argument
Description
Example Argument

resource

Resource to debug

sylius.admin_user

operation

Operation to debug

-

Output

This is the output without any arguments specified.

 ---------------------------------------------
  Alias
 ---------------------------------------------
  sylius.address
  sylius.address_log_entry
  sylius.adjustment
  sylius.admin_user
  sylius.avatar_image
  sylius.catalog_promotion
  sylius.catalog_promotion_action
  sylius.catalog_promotion_scope
  sylius.catalog_promotion_translation
  sylius.channel
  sylius.channel_price_history_config
  sylius.channel_pricing
  sylius.channel_pricing_log_entry
  sylius.country
  sylius.currency
  sylius.customer
  sylius.customer_group
  sylius.exchange_rate
  sylius.gateway_config
  sylius.inventory_unit
  sylius.locale
  sylius.oauth_user
  sylius.order
  sylius.order_item
  sylius.order_item_unit
  sylius.order_sequence
  sylius.payment
  sylius.payment_method
  sylius.payment_method_translation
  sylius.payment_request
  sylius.payment_security_token
  sylius.product
  sylius.product_association
  sylius.product_association_type
  sylius.product_association_type_translation
  sylius.product_attribute
  sylius.product_attribute_translation
  sylius.product_attribute_value
  sylius.product_image
  sylius.product_option
  sylius.product_option_translation
  sylius.product_option_value
  sylius.product_option_value_translation
  sylius.product_review
  sylius.product_reviewer
  sylius.product_taxon
  sylius.product_translation
  sylius.product_variant
  sylius.product_variant_translation
  sylius.promotion
  sylius.promotion_action
  sylius.promotion_coupon
  sylius.promotion_rule
  sylius.promotion_subject
  sylius.promotion_translation
  sylius.province
  sylius.shipment
  sylius.shipment_unit
  sylius.shipping_category
  sylius.shipping_method
  sylius.shipping_method_rule
  sylius.shipping_method_translation
  sylius.shop_billing_data
  sylius.shop_user
  sylius.tax_category
  sylius.tax_rate
  sylius.taxon
  sylius.taxon_image
  sylius.taxon_translation
  sylius.zone
  sylius.zone_member
 ---------------------------------------------

Example output

In this example we output the resource metadata of sylius.currency

Resource Metadata
-----------------

 ------------------------ --------------------------------
  Option                   Value
 ------------------------ --------------------------------
  alias                    "sylius.currency"
  section                  null
  formType                 null
  templatesDir             null
  routePrefix              null
  name                     "currency"
  pluralName               null
  applicationName          "sylius"
  identifier               null
  normalizationContext     null
  denormalizationContext   null
  validationContext        null
  class                    "App\Entity\Currency\Currency"
  driver                   null
  vars                     null
 ------------------------ --------------------------------

Operations
----------


 [INFO] This resource has no defined operations.

If you would like to learn more about Resources in Sylius, checkout the resource bundle documentation.


sylius:fixtures:list

Description

Lists available fixtures.

Usage

./bin/console sylius:fixtures:list

Output

Available suites:
 - default
Available fixtures:
 - locale
 - currency
 - geographical
 - payment_method
 - shipping_category
 - shipping_method
 - catalog_promotion
 - channel
 - customer_group
 - shop_user
 - admin_user
 - product_association_type
 - product_association
 - similar_product_association
 - product_option
 - product_attribute
 - product_review
 - tax_category
 - tax_rate
 - promotion
 - taxon
 - product
 - order
 - address
 - payments

If you would like to learn more about Fixtures in Sylius, checkout the fixtures documentation.


sylius:fixtures:load

Description

Load a fixture from the given suite. The default suite name is default .

Usage

./bin/console sylius:fixtures:load [<suite>]

If you would like to learn more about Fixtures in Sylius, checkout the fixtures documentation.


sylius:inform-about-gus

Description

Informs about Sylius internal statistical service.

Usage

./bin/console sylius:inform-about-gus

sylius:install

Description

Installs Sylius in your preferred environment.

Usage

./bin/console sylius:install [options]

This command executes several commands in sequence. However, each of these commands can also be executed individually:

  • sylius:install:assets

  • sylius:install:check-requirements

  • sylius:install:database

  • sylius:install:jwt-setup

  • sylius:install:sample-data

  • sylius:install:setup


sylius:install:assets

Description

Downloads and installs all Sylius media assets.

Usage

./bin/console sylius:install:assets

sylius:install:check-requirements

Description

Checks the system requirements to make sure that Sylius can be installed properly.

Usage

/bin/console sylius:install:check-requirements

sylius:install:database

Description

Install the Sylius database.

Usage

./bin/console sylius:install:database [options]

sylius:install:jwt-setup

Description

Generates a JSON Web Token. The JWT is used for authentication with the Sylius API and should be sent as a Bearer token in the Authorization header of each request.

Usage

./bin/console sylius:install:jwt-setup

sylius:install:sample-data

Description

Installs sample data into Sylius.

Usage

./bin/console sylius:install:sample-data [options]

sylius:install:setup

Description

Configures basic Sylius data setup.

Usage

./bin/console sylius:install:setup

sylius:payment:generate-key

Description

Generates a key for Sylius payment encryption.

Usage

./bin/console sylius:payment:generate-key [options]

It will ask you if you want to overwrite the existing key.


sylius:price-history:clear

Description

Clears the price history for entries older than the specified number of days.

Usage

./bin/console sylius:price-history:clear <days>

Arguments

Argument
Description
Example Argument

days

Number of days ago

5


sylius:promotion:generate-coupons

Description

Generates coupons for a given promotion.

Usage

./bin/console sylius:promotion:generate-coupons [options] [--] <promotion-code> <count>

Arguments

Argument
Description
Example Argument

promotion-code

Code of the promotion

CHRISTMAS_SALE

count

Amount of coupons to generate

5


sylius:remove-expired-carts

Description

Removes carts idle beyond the duration set in the sylius_order.expiration.cart config key.

Usage

./bin/console sylius:remove-expired-carts

sylius:show-plus-info

Description

Shows information about Sylius Plus and Sylius Store.

Usage

./bin/console sylius:show-plus-info

Output

Sylius Plus
-----------

Consists of modules:
 * B2B Suite
 * Marketplace Suite
 * Advanced Multi-store
 * Returns Management (RMA)
 * Multi-source Inventory
 * Loyalty system
 * RBAC (Role-Based Access Control)
 * Partial Shipment
 * One page checkout

For more information visit:  https://sylius.com/plus/

Sylius Store
------------

A wide range of community plugins both open source and licensed https://store.sylius.com/

sylius:theme:assets:install

Description

Installs themes web assets under a public web directory.

Usage

./bin/console sylius:theme:assets:install [options] [--] [<target>]

Help

The sylius:theme:assets:install command installs theme assets into a given
directory (e.g. the public directory).

  php ./bin/console sylius:theme:assets:install public

A "themes" directory will be created inside the target directory.

To create a symlink to each theme instead of copying its assets, use the
--symlink option (will fall back to hard copies when symbolic links aren't possible):

  php ./bin/console sylius:theme:assets:install public --symlink

To make symlink relative, add the --relative option:

  php ./bin/console sylius:theme:assets:install public --symlink --relative

If you would like to learn more about Frontend Customization have a look at the documentation.


sylius:theme:list

Description

Shows list of detected themes.

Usage

./bin/console sylius:theme:list

If you would like to learn more about Frontend Customization have a look at the documentation.


sylius:user:demote

Description

Demotes a user by removing roles.

Usage

./bin/console sylius:user:demote [options] [--] <email> [<roles>...]

The command will ask you to choose a user type: admin or shop user. It then asks for two arguments: the email and the roles.

Arguments

Argument
Description
Example Argument

roles

Security roles

ROLE_API_ACCESS, ROLE_ADMINISTRATION_ACCESS


sylius:user:promote

Description

Promotes a user by adding roles.

Usage

./bin/console sylius:user:promote [options] [--] <email> [<roles>...]

The command will ask you to choose a user type: admin or shop user. It then asks for two arguments: the email and the roles.

Arguments

Argument
Description
Example Argument

roles

Security roles

ROLE_USER


Last updated

Was this helpful?