Skip to content

Instantly share code, notes, and snippets.

@di3
Last active April 24, 2019 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save di3/c9af6fa9400a40fc6ab439f4ee238b8b to your computer and use it in GitHub Desktop.
Save di3/c9af6fa9400a40fc6ab439f4ee238b8b to your computer and use it in GitHub Desktop.
laravel bootstrap/app.php for .env handling
<?php
/*
.env
APP_ENV=local
.local.env
APP_DEBUG=true
.production.env
APP_DEBUG=false
*/
require_once(__DIR__ . '/../vendor/autoload.php');
//dynamic .env handling
if (file_exists(__DIR__ . '/../.env')) {
Dotenv::load(__DIR__ . '/../');
if (getenv('APP_ENV') && file_exists(__DIR__ . '/../.' . getenv('APP_ENV') . '.env')) {
Dotenv::load(__DIR__ . '/../', '.' . getenv('APP_ENV') . '.env');
}
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment