1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-04 16:10:08 +01:00
This commit is contained in:
Matt Stauffer
2023-02-18 21:49:11 -05:00
parent 3790e512af
commit 1d0483a0c8
2 changed files with 16 additions and 4 deletions

View File

@@ -690,19 +690,21 @@ function (ConsoleCommandEvent $event) {
/**
* Proxy commands through to an isolated site's version of PHP.
*/
$app->command('php [command]', function (OutputInterface $output, $command) {
$app->command('php [--site=] [command]', function (OutputInterface $output, $command) {
warning('It looks like you are running `cli/valet.php` directly; please use the `valet` script in the project root instead.');
})->descriptions("Proxy PHP commands with isolated site's PHP executable", [
'command' => "Command to run with isolated site's PHP executable",
'--site' => 'Specify the site to use to get the PHP version (e.g. if the site isn\'t linked as its directory name)',
]);
/**
* Proxy commands through to an isolated site's version of Composer.
*/
$app->command('composer [command]', function (OutputInterface $output, $command) {
$app->command('composer [--site=] [command]', function (OutputInterface $output, $command) {
warning('It looks like you are running `cli/valet.php` directly; please use the `valet` script in the project root instead.');
})->descriptions("Proxy Composer commands with isolated site's PHP executable", [
'command' => "Composer command to run with isolated site's PHP executable",
'--site' => 'Specify the site to use to get the PHP version (e.g. if the site isn\'t linked as its directory name)',
]);
/**

14
valet
View File

@@ -143,14 +143,24 @@ then
# Proxy PHP commands to the "php" executable on the isolated site
elif [[ "$1" = "php" ]]
then
$($PHP "$DIR/cli/valet.php" which-php) "${@:2}"
if [[ $2 == *"--site="* ]]; then
SITE=${2#*=}
$(php "$DIR/cli/valet.php" which-php $SITE) "${@:3}"
else
$(php "$DIR/cli/valet.php" which-php) "${@:2}"
fi
exit
# Proxy Composer commands with the "php" executable on the isolated site
elif [[ "$1" = "composer" ]]
then
$($PHP "$DIR/cli/valet.php" which-php) $(which composer) "${@:2}"
if [[ $2 == *"--site="* ]]; then
SITE=${2#*=}
$(php "$DIR/cli/valet.php" which-php $SITE) $(which composer) "${@:3}"
else
$(php "$DIR/cli/valet.php" which-php) $(which composer) "${@:2}"
fi
exit