Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages in full color showing how to combine Symfony with Docker, APIs, queues & async tasks, Webpack, Single-Page Applications, etc.

Buy printed version
WARNING: You are browsing the documentation for Symfony 4.3 which is not maintained anymore. Consider upgrading your projects to Symfony 5.1.

Verbosity Levels

Verbosity Levels

Console commands have different verbosity levels, which determine the messages displayed in their output. By default, commands display only the most useful messages, but you can control their verbosity with the -q and -v options:

# do not output any message (not even the command result messages)
$ php bin/console some-command -q
$ php bin/console some-command --quiet

# normal behavior, no option required (display only the useful messages)
$ php bin/console some-command

# increase verbosity of messages
$ php bin/console some-command -v

# display also the informative non essential messages
$ php bin/console some-command -vv

# display all messages (useful to debug errors)
$ php bin/console some-command -vvv

The verbosity level can also be controlled globally for all commands with the SHELL_VERBOSITY environment variable (the -q and -v options still have more precedence over the value of SHELL_VERBOSITY):

Console option SHELL_VERBOSITY value Equivalent PHP constant
-q or --quiet -1 OutputInterface::VERBOSITY_QUIET
(none) 0 OutputInterface::VERBOSITY_NORMAL
-v 1 OutputInterface::VERBOSITY_VERBOSE
-vv 2 OutputInterface::VERBOSITY_VERY_VERBOSE
-vvv 3 OutputInterface::VERBOSITY_DEBUG

It is possible to print a message in a command for only a specific verbosity level. For example:

// ...
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class CreateUserCommand extends Command
    // ...

    public function execute(InputInterface $input, OutputInterface $output)
        $user = new User(...);

            'Username: '.$input->getArgument('username'),
            'Password: '.$input->getArgument('password'),

        // available methods: ->isQuiet(), ->isVerbose(), ->isVeryVerbose(), ->isDebug()
        if ($output->isVerbose()) {
            $output->writeln('User class: '.get_class($user));

        // alternatively you can pass the verbosity level PHP constant to writeln()
            'Will only be printed in verbose mode or higher',

When the quiet level is used, all output is suppressed as the default write() method returns without actually printing.


The MonologBridge provides a Symfony\Bridge\Monolog\Handler\ConsoleHandler class that allows you to display messages on the console. This is cleaner than wrapping your output calls in conditions. For an example use in the Symfony Framework, see How to Configure Monolog to Display Console Messages.


The full exception stacktrace is printed if the VERBOSITY_VERBOSE level or above is used.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.