Saibotk
1ed13411c8
Removed the composer and php aliases and instead added a small script to call the correct php binary. This script is placed in the macos bin folder and we add the folder to the PATH in the .zprofile within the install-mac.sh. Adding it after brew registers its paths, allows our script to be priortized instead of the currently linked php binary. Because the .zprofile file is used to setup environment variables and it being called for non-interactive sessions too, calls to php in JS scripts for example will now correctly use the isolated php version via valet.
17 lines
482 B
Bash
Executable file
17 lines
482 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# We use this custom script here to also allow interactive shell sessions e.g. php
|
|
# invoked in JS scripts to use the correct isolated version.
|
|
|
|
DIR=$HOME/.composer/vendor/laravel/valet
|
|
PHP=/opt/homebrew/opt/php/bin/php
|
|
|
|
# Proxy PHP commands to the "php" executable on the isolated site
|
|
if [[ $1 == *"--site="* ]]; then
|
|
SITE=${2#*=}
|
|
$($PHP "$DIR/cli/valet.php" which-php $SITE) "${@:2}"
|
|
else
|
|
$($PHP "$DIR/cli/valet.php" which-php) "${@:1}"
|
|
fi
|
|
|
|
exit
|