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!

It's only fair to share...
Share on Facebook0Share on Google+0Tweet about this on TwitterShare on LinkedIn0Pin on Pinterest0Share on StumbleUpon0Share on Reddit0Buffer this pageShare on Tumblr0Flattr the author

Published by

Patrick Curl

Patrick Curl is a developer, coder, writer, blogger, affiliate marketer, and more. He lives and breathes apps/startups and has a permanent residency on HackerNews.

One thought on “How to Use Local Environment as Default in Laravel Artisan CLI”

  1. Hi Patrick, maybe this is a little dumb question, the “*.dev” is a reference of the folder on app>config which contains local config? 
    Btw, nice header 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *