Laravel Console Aliases on Windows

David Ngugi
Aug 25, 2017 · 2 min read

I just read an article on Laravel News about Laravel bash aliases but they all assumed that every developer uses a Linux box or a Mac. Truth be told, many developers do use the Windows operating system as their main or even only development environment. I am one of them.

First, a console/bash alias is a pseudo-name like a nickname but for a command. All developers using the Laravel PHP framework have had to endure using the ‘long’ commands like ‘php artisan migrate:refresh’. This is not a Laravel problem only but with many commands you may normally use such as Git commands to fix merge conflicts or resetting your project to a previous state.

So how do we create a console alias in Windows you ask? The quickest way is to take advantage of a command called Doskey from Doskey.exe. These application enables you to create a macro that is accessible globally on the command prompt with the given name.

Examples of common Laravel aliases

Creating an alias for php artisan
Running pa command alias runs exactly like php artisan command

Now you must be asking yourself, “Why didn’t I do this before?”. You now have a solution to all your console typing woes. Make all your command aliases using this scheme:

doskey [alias]=[command]

Replace [alias] with the name of your command and [command] with the actual command including arguments you want to replace. Here are some of my aliases listed using doskey /m:

Click here to visit Laravel News if you want to learn the Bash way of creating aliases.

)

David Ngugi

Written by

Senior Developer at Andela. Lead Software Engineer at lifeflowventures.com. Visit davidngugi.com

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade