Tired of switching tooling versions between PHP projects? Perhaps you've used a Python virtual environment before? This is an approximation of the same idea for PHP projects. It doesn't deal with installing packages though.
Features:
Supports
Note that you need to have the tooling pre-installed.
src/psh.sh
to psh
in your path. eg cd src; ln -s $PWD/psh.src $HOME/bin/psh
pshrc
file to your project folder ala:php=7.3
composer=1.10
node=15.
psh
to start a subshell with tooling set to those versions. Type exit
to exit the subshell.If you're using zsh you can use the following function to automatically enter the subshell:
function chpwd() {
if [ -r $PWD/pshrc ]; then
psh
return
fi
}
You can override tooling versions by passing options to psh
. They take priority over matching pshrc
versions:
$ psh --help
Usage: psh <[options]>
Options:
-h --help Show this message
--composer=x.[y.z] Set Composer version
--php=x.[y.z] Set PHP version
--node=x.[y.z] Set Node version
example: psh --php=7.3.