OK, so I realise this is a bit lazy. :-) But I'd like to be able to run Artisan commands without having to type the "php" part. So just artisan migrate
instead of php artisan migrate
for example.
Is it possible to "install" artisan like this? Or do I just have to live with typing the four extra characters?
PS - yes, I know I just typed hundreds of characters to ask how to save typing four characters. :-) But I only have to ask once ... and if someone has an answer, I can save typing four characters hundreds of times.
My main dev box is a Mac with El Capitan 10.11.6, but I also use Ubuntu and RedHat in VMs, test servers, etc.
On Mac you can create bash aliases. Edit ~/.bash-profile
hidden file which is in your user's directory. In case if you're using zsh then edit ~/.zshrc
file.
Here's my file which creates couple of aliases:
alias composer="php /usr/local/bin/composer.phar"
alias a="php artisan"
alias am="php artisan migrate:refresh --seed"
export PATH=$PATH:~/.composer/vendor/bin
So, when I run a make:model
, it runs php artisan make:model
. When I enter am
command, artisan
refreshes all migrations and seeds the data.