Using Dot Env files to manage settings

Posted: 2014-05-18 10:59:08

Wow. Included in Laravel

  1. removed due to old news



I really like the second link and how it sets up a .env file first to just return a simple string. After that you can have the .env.production.php or .env.local.php that laravel can look for.

$env = $app->detectEnvironment(function()
    if (file_exists(__DIR__ . '/../.env')) {
        return include(__DIR__ . '/../.env');
    } else {
        return 'production';

Quite simple at that point to separate all of the environments.