Polyscope - The agent-first dev environment for Laravel

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
Tinkerwell

Enjoy coding and debugging in an editor designed for fast feedback and quick iterations. It's like a shell for your application – but with multi-line editing, code completion, and more.

Visit Tinkerwell
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
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Laravel Cloud logo

Laravel Cloud

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

Laravel Cloud
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
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 →
The Laravel Community Mobile App Helps You Discover Events and Connect With Developers image

The Laravel Community Mobile App Helps You Discover Events and Connect With Developers

Read article
A PHP Package for Concurrent Website Crawling image

A PHP Package for Concurrent Website Crawling

Read article
A Clean API for Reading PHP Attributes image

A Clean API for Reading PHP Attributes

Read article
Serve Markdown Versions of Your Laravel Pages to AI Agents image

Serve Markdown Versions of Your Laravel Pages to AI Agents

Read article
The Inertia v3 Beta is Here image

The Inertia v3 Beta is Here

Read article
Polyscope Is an Ai-First Dev Environment for Orchestrating Agents image

Polyscope Is an Ai-First Dev Environment for Orchestrating Agents

Read article