Last active
September 25, 2015 09:48
-
-
Save graymic/08e50550be5d435ed872 to your computer and use it in GitHub Desktop.
environments - dotenv Laravel5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// You can ofc ignore this and load it in from the default .env file, however I prefer this method for load dot files. | |
// Dotenv::load(__DIR__.'/../'); | |
// Dotenv::require('APP_ENV'); | |
$dotenv = function () { | |
$env = getenv('APP_ENV') ?: 'local'; | |
if (file_exists(__DIR__.'/../')) { | |
Dotenv::load(__DIR__.'/../', '.env.' . $env); | |
} | |
return $env; | |
}; | |
$env = $app->detectEnvironment($dotenv); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment