Skip to content

Instantly share code, notes, and snippets.

@adamwathan
Created April 15, 2014 14:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adamwathan/10737348 to your computer and use it in GitHub Desktop.
Save adamwathan/10737348 to your computer and use it in GitHub Desktop.
Better default for Laravel environment detection
<?php
// bootstrap/start.php
/*
|--------------------------------------------------------------------------
| Detect The Application Environment
|--------------------------------------------------------------------------
|
| Laravel takes a dead simple approach to your application environments
| so you can just specify a machine name for the host that matches a
| given environment, then we will automatically detect it for you.
|
*/
$env = $app->detectEnvironment(function() {
return getenv('APPLICATION_ENV') ?: 'local';
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment