As developers, we spend a lot of time in the terminal running dozens of commands. Some commands can be long to type or tricky and be similar to other tools but not exactly the same! That is why a lot of us loves autocompletion.

The good news is that starting with Symfony CLI v5.10, the Symfony CLI provides an auto-completion for Bash, ZSH, and Fish shells.

Demo Auto Completion CLI

To enable it, follow the instructions shown by symfony completion --help.

But this is not it! Did you know that Symfony Console provides auto-completion for bin/console within your shell? It does! Since version 5.4 for Bash, 6.1 for Fish, and 6.2 for ZSH. This why the Symfony CLI can forward auto-complete instructions to your Symfony project when auto-completing symfony console [TAB] out of the box!

Demo Auto Completion CLI

But there is more! You might know that Composer itself uses Symfony Console. So yes, symfony composer also works!

Demo Auto Completion CLI

This is a great for anyone working on several projects with different environments, Symfony or PHP versions to get an auto-completion that works seamlessly.

As a nice little bonus, because Symfony CLI is also developed using standalone Open-Source libraries, this auto-completion feature is now available for any tool using symfony-cli/console, as the Blackfire CLI.

Published in #Tutorials