Symfony Console Autocomplete

Shell autocompletion for Symfony Console based scripts
Alternatives To Symfony Console Autocomplete
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Symfony Console Autocomplete4941125 months ago26April 11, 20223otherPHP
Shell autocompletion for Symfony Console based scripts
Vim Symfony82
7 years ago3VimL
A vim plugin to handle symfony and all that stuff
Sublime Symfonycommander64
11 years ago3Python
A Sublime Text 2 package that integrates the symfony 2 console right into your editor.
Zsh Symfony Console Plugin15
9 years agoShell
Oh My Zsh plugin for the Symfony Console component
Symfony Vscode13
3 years ago27mitTypeScript
Symfony extension for Visual Studio Code
Jarvis13
4 years ago41January 30, 2019mitPHP
The Ultimate Tool to Manage php application in virtual machine.
Symfony Console Filechooser7
5 years agomitPHP
Filechooser Helper for Symfony console (with autocompletion support)
Symfony.plugin.zsh5
8 months agomitShell
Zsh plugin for Symfony
Alternatives To Symfony Console Autocomplete
Select To Compare


Alternative Project Comparisons
Readme

Symfony console autocomplete

GitHub CI Status GitHub Issues Build Status

PHP Version Stable Version

Total Downloads Monthly Downloads Daily Downloads Packagist Stars

Enables shell autocompletion for tools based on the Symfony Console (Symfony framework, Composer, PHPSpec, Behat, etc.)

screenshot of symfony-console-autocomplete in action: zsh autocompletion for composer (press tab two times)

Prerequisites

  • Make sure the global composer project is configured properly with your shell. Notably, the composer global bin directory needs to be in your path. See https://getcomposer.org/doc/03-cli.md#global for instructions on how todo that.
  • If you're using bash, you'll have to make sure programmable completion functions are available. Linux distributions usually ship it and enable it by default. On Mac OSX, you can install it with brew (brew install bash-completion) and enable it by adding source $(brew --prefix)/etc/bash_completion at the end of your .bashrc.

Installation

Install the tool globally with Composer :

composer global require bamarni/symfony-console-autocomplete

Quick setup

Add the following line at the end of your shell configuration file (~/.bash_profile or ~/.zshrc) :

eval "$(symfony-autocomplete)"

Close / re-open your terminal window and you're ready to go!

Note that quick setup only works for supported tools.

Static setup

If you don't like all the magic from the quick setup and want to go with a more standard way, you can dump a static completion file for a given tool :

symfony-autocomplete composer

This will print the completion script for Composer to stdout. The output should be saved at a specific location depending on your OS / setup. Here are a few examples :

# BASH - Ubuntu / Debian
symfony-autocomplete composer | sudo tee /etc/bash_completion.d/composer

# BASH - Mac OSX (with Homebrew "bash-completion")
symfony-autocomplete composer > $(brew --prefix)/etc/bash_completion.d/composer

# ZSH - Config file
symfony-autocomplete composer > ~/.composer_completion && echo "source ~/.composer_completion" >> ~/.zshrc

# FISH
symfony-autocomplete --shell=fish composer > ~/.config/fish/completions/composer.fish

If you are running an environment that does not have automatic execution of PHP scripts, then you will need to call PHP and the script in question :

symfony-autocomplete "php ./artisan"

General tips

Update

To update the tool to a new version use :

composer global update bamarni/symfony-console-autocomplete

Symfony framework completion

In order to get completion running, you shouldn't prepend php at the beginning of the command :

app/console [TAB]

Tips for Bash users

Alias support

By default, completion for your aliases won't be enabled. If you're using aliases (e.g. "c" for "composer", "pspec" for "phpspec", etc.), you have to pass them explicitly :

symfony-autocomplete --aliases=c --aliases=pspec

Tips for Docker users

Defining the SHELL environment variable

If you connect to your container using something similar to docker exec -it container bash then you may find that the completions cannot be built due to an inability to locate the SHELL environment variable. This has been reported in https://github.com/bamarni/symfony-console-autocomplete/issues/32

A solution is to supply the SHELL environment variable as part of the docker exec command:

docker exec -e SHELL=bash -it container bash

Supported tools

All tools using the Symfony Console component are supported.

However, quick setup only works if the entrypoint is named console or in the following list of tools:

Popular Symfony Projects
Popular Autocompletion Projects
Popular Frameworks Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Php
Shell
Bash
Symfony
Zsh
Completion
Fish Shell
Autocompletion
Behat
Symfony Console