Easily swith php version.
git clone https://git.stefanwimmer128.eu/stefanwimmer128/phpenv.git $ZSH_CUSTOM/plugins/phpenvAdd to plugins in .zshrc:
plugins=(phpenv)git clone https://git.stefanwimmer128.eu/stefanwimmer128/phpenv.git ~/.phpenvSource phpenv.sh
source ~/.phpenv/phpenv.shBy setting the PHPENV environment variable you can define which php binary you want to use for the php command.
php --version # 8
PHPENV=php7.4 php --version # 7.4You can define multiple options in PHPENV (divided by :):
PHPENV=php74:php7.4 php --version # 7.4It tries calling php74 first, and if not continues with php7.4.
By using direnv you can switch php version per folder by setting PHPENV in the .envrc file:
export PHPENV="php7.4:php74"