How to Use Local Environment as Default in Laravel Artisan CLI

I have to say, I absolutely LOVE Laravel – everything about it.

One of my favorite features is the ability to separate your app into local/production versions.

I use a lot of packages for development, that I just don’t need on my production version of the app. How do I resolve this? By using two different environments w/ different App.php configs. Read my tutorial on this here.

You might find that this only works for your app when running it in the browser. Here’s how to make sure that the local environment is ALSO set for command-line e.g. Artisan and Tinker.

One option of course is to do:

But who wants to write –env=local after EVERY artisan command? I am a pragmatist and believe in using technology to my advantage. This is great when needing to switch back and forth for a minute, but when doing it all the time you need an alternative.

next add “PatrickPC” to bootstrap/start.php

Now artisan should run w/ local environment as default when on this machine, let’s test it:

Got questions? Leave a comment!