Composer shell completion for Bash
The composer-completion.bash
script provides shell completion in bash for composer.
The completion routines support completing all composer commands and options, even if provided by plugins.
Installation
If you’re using Homebrew, you should tap my Homebrew-PHP repository. And if you’re using MacPorts, you should use my MacPorts-PHP repository.
Manual installation (not recommend on Mac OS, see above):
- Ensure you installed:
bashversion ≥ 4.x, including ≥ 5.xbash-completionversion ≥ 2.x- additionally you need to have the following tools in
PATH:phpversion ≥ 5.6, including ≥ 7.x and ≥ 8.xgrepsedtrsortuniq
- … and last but not least,
composerversion ≥ 1.5, including ≥ 2.x
- Install
composer-completion.phpfile:-
copy it somewhere (e.g.
~/.composer-completion.php) and put the following line in your~/.bash_profile:export COMPOSER_COMPLETION_PHP_SCRIPT=~/.composer-completion.php -
you can also nail down the php interpreter to use by adding the following line in your
~/.bash_profile:export COMPOSER_COMPLETION_PHP=/path/to/your/php
-
- Install
composer-completion.bashfile:- a.) Either, place it in a
bash-completion.dfolder, like:/etc/bash-completion.d/usr/local/etc/bash-completion.d~/.bash-completion.d
-
b.) Or, copy it somewhere (e.g.
~/.composer-completion.bash) and put the following line in your~/.bash_completion:source ~/.composer-completion.bash
- a.) Either, place it in a
Contributing
Look at the contribution guidelines
Want more?
If you’re using Homebrew, take a look at my Homebrew-PHP tap.
If you’re using MacPorts, take a look at my MacPorts-PHP repository.
Cheers!