Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

Commit ef1a943

Browse files
EHLOVaderMischa Braam
authored andcommitted
Add proxy for Drush commands (#635)
This will ensure that isolated sites use the correct version of php with Drush. User Login (ULI) has been improved with added uri which is known by Valet. This requires the added command which-uri to output the domain without any protocol.
1 parent c9755e7 commit ef1a943

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

cli/valet.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,13 @@
737737
$app->command('configure', function () {
738738
DriverConfigurator::configure();
739739
})->descriptions('Configure application with know framework settings');
740+
741+
/**
742+
* Which-uri command which outputs the URL of the current site.
743+
*/
744+
$app->command('which-uri', function () {
745+
output(Site::domain(null));
746+
})->descriptions('Displays the URL of the current site');
740747
}
741748

742749
/**

valet-plus

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,20 @@ then
182182

183183
exit
184184

185+
# Proxy Drush commands with the "php" executable on the isolated site
186+
elif [[ "$1" = "drush" ]]
187+
then
188+
if [[ $2 == *"--site="* ]]; then
189+
SITE=${2#*=}
190+
$(php "$DIR/cli/valet.php" which-php $SITE) $(which drush) "${@:3}"
191+
elif [[ $2 == "uli" ]]; then
192+
$(php "$DIR/cli/valet.php" which-php) $(which drush) uli --uri=$(php "$DIR/cli/valet.php" which-uri) "${@:3}"
193+
else
194+
$(php "$DIR/cli/valet.php" which-php) $(which drush) "${@:2}"
195+
fi
196+
197+
exit
198+
185199
# Finally, for every other command we will just proxy into the PHP tool
186200
# and let it handle the request. These are commands which can be run
187201
# without sudo and don't require taking over terminals like Ngrok.

0 commit comments

Comments
 (0)