Skip to content

nhedger/php-switch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation


php-switch is small utility designed to help Homebrew users to either switch the default PHP version on their system or to run scripts with a specific PHP version. It is meant to be used with the shivammathur/php tap.

Installation

php-switch is distributed as a Homebrew formula, which you can install by running the following command.

brew install nhedger/php-switch/php-switch

Finally, initialize it by adding the following line anywhere in your ~/.zshrc file.

source php-switch

Usage

Duing initialization, php-switch will look for installed PHP versions in your Homebrew Cellar. Any installed PHP version will be made available to you in your shell as functions named after the PHP version.

Switching to a different version

To switch to a PHP version, simply type its version number (omitting the patch number). For example, to switch to PHP 8.1 run the following.

8.0

Once the PHP version has been switched, its version will be printed out.

Running under different version

You may not always want to switch your default PHP version but still need to quickly run a script under a specific PHP version. To do that, prefix your PHP script with the version you want to run it with. For example, to run test.php under PHP 7.4, run the following.

7.4 test.php

License

This utility script is open-sourced software distributed under the MIT License.

About

Quickly switch to or run alternative PHP versions on the command line.

Topics

Resources

License

Stars

Watchers

Forks

Languages