As per how to select versions easily, the Symfony project provides a Symfony CLI and one of the features it provides is checking for a `.php-version` file in the current directory and selecting the correct php binary from the PATH accordingly.
I use that when I'm dealing with projects on different versions.