The Console component is the most downloaded non-polyfill component (+530 million downloads as of November 2022) and the component with most dependents overall (nearly 10,000 public projects depend on it). In Symfony 6.2 we added some nice new features to it.
Show Commands When Running Namespace
Contributed by
Wouter de Jong
in #47750.
When running only the namespace instead of the full command name, Symfony displays an error message:
$ bin/console debug
Command "debug" is not defined. Did you mean one of these?
debug:autowiring
debug:config
debug:container
[...]
In Symfony 6.2 we're improving this to list instead all the commands defined under the given namespace:
$ bin/console debug
Symfony 6.2.0 (env: dev, debug: true) #StandWithUkraine https://sf.to/ukraine
Usage:
command [options] [arguments]
[...]
Available commands for the "debug" namespace:
debug:autowiring List classes/interfaces you can use for autowiring
debug:config Dump the current configuration for an extension
debug:container Display current services for an application
debug:dotenv Lists all dotenv files with variables and values
debug:event-dispatcher Display configured listeners for an application
debug:router Display current routes for an application
Resuming Progress Bars
Contributed by
Ivan Yivoff
in #46242.
Symfony 6.2 adds the option to resume a progress bar so it doesn't always start
from 0
. This is useful not only to resume long standing tasks but also to
show the progress of a complex task with optional steps that can be skipped:
use Symfony\Component\Console\Helper\ProgressBar;
// create a new progress bar (length = 100 units)
$progressBar = new ProgressBar($output, 100);
// pass the new optional second argument to display the progress bar
// starting at some point different from 0 (in this example = 25)
$progressBar->start(null, 25);
Improved Color Support
Contributed by
Boudry Julien
in #46944
and #47407.
In Symfony 5.2 we introduced true colors in the console to support Ansi24 (24-bit colors) mode. In Symfony 6.2 we're improving color support by adding a new Ansi8 (256-color) mode for terminals that don't support true colors.
The best of all is that you don't have to change anything in your code. You can
still use 24-bit colors and Symfony will transform them to the nearest 8-bit
colors if the terminal doesn't support them (e.g. #c0392b
(24-bit) is degraded
to #d75f5f
in 8-bit color terminals and to red
in 4-bit color terminals).
Lastly, we've introduced a setColorMode(?AnsiColorMode $colorMode)
method
in the main Terminal
class so you can force a color mode in the terminal
(it overrides any env var defining the color mode).
Zsh Shell Autocompletion
Contributed by
Jitendra
and Jérôme Tamarelle
in #47018.
In Symfony 5.4 we introduced console autocompletion so you can press the TAB
key to see a list of contextual suggestions for commands, arguments, options, etc.
Initially it only worked on Bash shells, but in Symfony 6.2 we're also adding
support for Zsh shell autocompletion.
Limiting the Height of Console Sections
Contributed by
Wouter de Jong
in #47308.
Console introduced output sections in Symfony 4.1. They allow to define different output regions that you can manage independently. In Symfony 6.2 we're adding a feature to limit the height of any section:
class MyCommand extends Command
{
// ...
protected function execute(InputInterface $input, OutputInterface $output): int
{
// ...
$debugMessages = $output->section();
$debugMessages->setMaxHeight(3);
// ...
}
}
When the contents overflow the given number of rows, the new contents replace the existing contents. This is very useful to show verbose output in long running processes, without taking over the complete terminal buffer:

In case you missed it, your company can sponsor the Console component or any other component published by Symfony. Check out the details of our Symfony Sponsoring Program.
<hr style="margin-bottom: 5px" />
<div style="font-size: 90%">
<a href="https://symfony.com/sponsor">Sponsor</a> the Symfony project.
</div>
Login to add comment
Other posts in this group

This week, Symfony celebrated the SymfonyOnline June 2025 conference with great success. Meanwhile, development efforts focused on improving invokable commands for the upcoming Symfony 7.4 version. Th

This week, development activity focused on the upcoming Symfony 7.4 and 8.0 versions, which will deprecate and remove many features. In addition, we published a case study about Yousign. Finally, we'r

As digital signatures become the norm in modern business, Yousign has established itself as a trusted leader across Europe. Behind its simple, intuitive interface is a powerful technical engine, handl

Get ready for the exciting SymfonyOnline June 2025, kicking off in a few days only! There’s still time to register and join the international online Symfony conference—along with pre-conferenc

This week, Symfony released the stable version of Symfony 7.3, which includes lots of amazing new features. We also published the maintenance versions 6.4.22 and 7.2.7.
Symfony development highlights

This is the second part of the blog post showcasing the main DX (developer experience) features introduced in Symfony 7.3. Read the first part of this blog post.
Verify URI Signatures… https://symfon

Symfony 6.4.22 has just been released. Read the Symfony upgrade guide to learn more about upgrading Symfony and use the SymfonyInsight upgrade reports to detect the code you will need to change in you