diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh index 2c6044aef..22ecbf299 100644 --- a/plugins/composer/composer.plugin.zsh +++ b/plugins/composer/composer.plugin.zsh @@ -49,7 +49,17 @@ alias cget='curl -s https://getcomposer.org/installer | php' # Add Composer's global binaries to PATH, using Composer if available. if (( $+commands[composer] )); then - export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null) + _retrieve_cache composer + + if [[ -z $__composer_bin_dir ]]; then + __composer_bin_dir=$(composer global config bin-dir --absolute 2>/dev/null) + _store_cache composer __composer_bin_dir + fi + + # Add Composer's global binaries to PATH + export PATH="$PATH:$__composer_bin_dir" + + unset __composer_bin_dir else [ -d $HOME/.composer/vendor/bin ] && export PATH=$PATH:$HOME/.composer/vendor/bin [ -d $HOME/.config/composer/vendor/bin ] && export PATH=$PATH:$HOME/.config/composer/vendor/bin