Skip to content

How to Use the Console

Warning: You are browsing the documentation for Symfony 3.x, which is no longer maintained.

Read the updated version of this page for Symfony 7.2 (the current stable version).

The Using Console Commands, Shortcuts and Built-in Commands page of the components documentation looks at the global console options. When you use the console as part of the full-stack framework, some additional global options are available as well.

By default, console commands run in the dev environment and you may want to change this for some commands. For example, you may want to run some commands in the prod environment for performance reasons. Also, the result of some commands will be different depending on the environment. For example, the cache:clear command will clear and warm up the cache for the specified environment only:

1
2
3
4
5
# clear (and warm up) the cache of the 'prod' environment
$ php bin/console cache:clear --env=prod

# this is equivalent:
$ php bin/console cache:clear --no-warmup -e prod

In addition to changing the environment, you can also choose to disable debug mode. This can be useful where you want to run commands in the dev environment but avoid the performance hit of collecting debug data:

1
$ php bin/console list --no-debug
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.
TOC
    Version