Laravel bash alias

In this post I explain how to add some useful Laravel bash alias in the bash shell, so you haven’t to type this long commands.

I use this alias in the Homestead VM Vagrant machine.

You have to append this commands in the ~/.bash_aliases (better than in the ~/.bashrc file)

$vi ~/.bash_aliases
alias pa='php artisan'
alias par:l='php artisan route:list'
alias pam='php artisan migrate'
alias pam:r='php artisan migrate:refresh'
alias pam:rs='php artisan migrate:refresh --seed'
alias cu='composer update'
alias ci='composer install'
alias cda='composer dump-autoload -o'
alias vu='cd ~/Homestead && vagrant up'
alias vs='vagrant suspend'
alias vssh='vagrant ssh'

You have to load the ~/.bash_aliases file in the ~/.bashrc file

if [ -f ~/.bash_aliases ]; then
 . ~/.bash_aliases
fi

Then you have to reload the script

source ~/.bashrc

The source command executes the content of the file passed as argument in the current shell

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.