Add Your Own Aliases to Laravel Homestead
Published on by Paul Redmond
Laravel Homestead ships with some aliases that get copied into your Homestead virtual machine when you provision it. These aliases are available inside the virtual machine, and you can also add your aliases as well so that you have the same aliases in Homestead that you might use on your local setup. I’ll quickly show you how you can add your aliases.
After you install Homestead and run bash init.sh
, the init script copies the aliases file to ~/Homestead/aliases
on OS X.
When you make changes to the aliases file, you need to reprovision the image:
vagrant reload --provision
If you look at the Vagrantfile, you can see how the aliases file gets copied into the Homestead machine. By default, Homestead has some helpful aliases already defined that you can use right away:
alias ..="cd .."alias ...="cd ../.." alias h='cd ~'alias c='clear'alias art=artisan alias phpspec='vendor/bin/phpspec'alias phpunit='vendor/bin/phpunit'alias serve=serve-laravel alias xoff='sudo phpdismod -s cli xdebug'alias xon='sudo phpenmod -s cli xdebug'
For example, you can run “h” to go to the home folder, or run “phpunit” without referencing the full vendor/bin path. Another way I like to achieve something similar is adding vendor/bin
to my path:
export $PATH="./vendor/bin:$PATH"
Also, last week we shared some great Laravel community bash aliases that you might consider adding to Homestead!