Run bin/magento from Anywhere in Your Magento 2 Installation
Just a little script I threw together so I could run bin/magento
from anywhere inside
my Magento 2 installation.
Saves me a few taps (cd
’s) anyway :)
To download, wget https://gist.githubusercontent.com/andrew-smart/635e4c26c316ced07eb140b38dc0c1f6/raw/fa5ce695946a2733ac31bdd68f9488ba7c116d35/bin-magento.sh
Then;
chmod +x ./bin-magento.sh
Don’t forget to add it to your path (perhaps put it in /usr/local/bin) if you want to run it from anywhere (it is kind of the point :D)
Then just run it as if you are running bin/magento but this time you can run it from ./app/code, or perhaps ./vendor like so;
bin-magento.sh cache:flush
Lovely hob.
Like this post? Share it :)