A workaround (and maybe there are better ways) is about updating the $PATH every time you get the shell prompt and that's possible by using PROMPT_COMMAND environment variable (in bash).
So you can define a function like this:
#You can modify this function to update the path
#only when the current directory is under '/home/www/website_folder'
checkPath() {
if [[ -z $OLDPATH ]]; then
OLDPATH="$PATH";
PATH="${PATH}:${PWD}/vendor/bin";
else
PATH="${OLDPATH}:${PWD}/vendor/bin"
fi
}
The if condition prevents adding a new path every time you run a command. So you will have always your original $PATH + $PWD/vendor/bin where $PWD is the working directory
And in your shell set this:
PROMPT_COMMAND='checkPath'
With the code above every time you get the shell prompt (when a command finished its execution the PROMPT_COMMAND content (checkPath function in this case) is executed).
So if you type:
cd /home/www/example_1.com
The $PATH will have:
/home/www/example_1.com/vendor/bin
When you change to example_2.com like this:
cd /home/www/example_2.com
#or
cd ../example_2.com
The $PATH will have:
/home/www/example_2.com/vendor/bin
Disadvantage
Using this workaround might be useful but if you change to a directory such as /home/www the $PATH will have this value:
/home/www/vendor/bin
As you can see, the $PATH might have a non-existent directory but AFAIK this will not have issues with your shell, remember that the PATH is changed every time (when you cd to another directory). In case of /home/www/vendor/bin exists then the files under that directory will be recognized by the PATH variable.
Also, if you had drush installed globally in your system (e.g. in /usr/bin) then the command drush provided by /home/www/example_?.com/vendor/bin/ will not work.
A solution to this is to prepend ${PWD}/vendor/bin to $PATH instead of appending it:
checkPath() {
if [[ -z $OLDPATH ]]; then
OLDPATH="$PATH";
PATH="${PWD}/vendor/bin:${PATH}";
else
PATH="${PWD}/vendor/bin:${OLDPATH}"
fi
}