Outsource Laravel Development Partner - $3200/Month | Bacancy

Laravel Bash Aliases

Published on by

I don’t use a lot of aliases but I do rely on artisan autocomplete in ZSH. To try and improve my workflow I asked on Twitter if anyone had any useful Laravel bash aliases and had some great responses. Below is a list and I’m sure you will find some goodies:

Chris Fidao

alias ll="ls -lah" # List all, with human readable filesizes
alias c="clear" # Typing the whole word is annoying
alias h="cd ~/" # Go home
 
alias v='vagrant version && vagrant global-status'
alias vst='vagrant status'
alias vup='vagrant up'
alias vdo='vagrant halt'
alias vssh='vagrant ssh'
alias vkill='vagrant destroy'

This works with git status -sb, and will lint any PHP files that have been modified

alias lint="git status -sb | awk '/s/{print $2}' | sed 1d | xargs -n1 php -l"

Andrew Westrope

alias pa="php artisan"
alias par="php artisan routes"
alias pam="php artisan migrate"
alias pam:r="php artisan migrate:refresh"
alias pam:roll="php artisan migrate:rollback"
alias pam:rs="php artisan migrate:refresh --seed"
alias pda="php artisan dumpautoload"
alias cu="composer update"
alias ci="composer install"
alias cda="composer dump-autoload -o"

Sid

Saves quite a bit of typing

alias art="php artisan"

I added this one as I found myself absent-mindedly typing the whole word now and then

alias artisan = "php artisan"

Handy to add new domains to the host file after mapping on Homestead.yaml

alias edit-host="sudo pico /etc/hosts"

Reset and reseed database

alias db-reset="php artisan migrate:reset && php artisan migrate --seed"

Dwight Watson

I use one alias, and an SSH config.

alias hs="cd ~/Sites/homestead && vagrant up"

To get into the box, I put my SSH config file (~/.ssh/config):

Host homestead
HostName 127.0.0.1
User vagrant
Port 2222

Now, I can type ‘ssh homestead’ to get into the box. Might not be the shortest alias, but I find using the SSH config file makes it easy when you have lots of boxes/servers to get into all the time.

Jeremy Worboys

export PATH="vendor/bin:$PATH"
 
alias c='clear'
alias l='ls -FlAGh'
alias test="clear && phpunit"
alias art='php artisan'
alias pubkey="/bin/cat ~/.ssh/id_rsa.pub | pbcopy"
alias name="uname -n | tee /dev/ttys001 | pbcopy"
alias vapro="curl -L http://bit.ly/vaprobash > Vagrantfile"
alias chrome="/usr/bin/open -a /Applications/Google Chrome.app"
 
function convertarrays() {
curl "https://raw.githubusercontent.com/thomasbachem/php-short-array-syntax-converter/master/convert.php" -o convert.php
find . -name "*.php" ! -path "*vendor*" -exec php "convert.php" -w "{}" ;
rm convert.php
}

Yitzchok Willroth

Sorry, couldn’t resist… ;) Hope it made you smile.

alias phart='php artisan';

Do you have any that haven’t been mentioned? Share in the comments.

Eric L. Barnes photo

Eric is the creator of Laravel News and has been covering Laravel since 2012.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $3200/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit

The latest

View all →
FrankenPHP v1.11.2 Released With 30% Faster CGO, 40% Faster GC, and Security Patches image

FrankenPHP v1.11.2 Released With 30% Faster CGO, 40% Faster GC, and Security Patches

Read article
Capture Web Page Screenshots in Laravel with Spatie's Laravel Screenshot image

Capture Web Page Screenshots in Laravel with Spatie's Laravel Screenshot

Read article
Nimbus: An In-Browser API Testing Playground for Laravel image

Nimbus: An In-Browser API Testing Playground for Laravel

Read article
Laravel 12.51.0 Adds afterSending Callbacks, Validator whenFails, and MySQL Timeout image

Laravel 12.51.0 Adds afterSending Callbacks, Validator whenFails, and MySQL Timeout

Read article
Handling Large Datasets with Pagination and Cursors in Laravel MongoDB image

Handling Large Datasets with Pagination and Cursors in Laravel MongoDB

Read article
Driver-Based Architecture in Spatie's Laravel PDF v2 image

Driver-Based Architecture in Spatie's Laravel PDF v2

Read article