Skip to content

Instantly share code, notes, and snippets.

@graymic
Last active September 25, 2015 09:48
Show Gist options
  • Save graymic/08e50550be5d435ed872 to your computer and use it in GitHub Desktop.
Save graymic/08e50550be5d435ed872 to your computer and use it in GitHub Desktop.
environments - dotenv Laravel5
<?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