Last active
February 19, 2024 10:50
-
-
Save petehouston/fdc39a7afa2e872ca6aa to your computer and use it in GitHub Desktop.
[Laravel 4.2] The environment dotfile configuration
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 | |
//file: /.env.local.php | |
// return the configuration for the 'local' environment | |
return array( | |
'db_host' => '127.0.0.1', | |
'db_name' => 'DB_NAME', // specify database name | |
'db_user' => 'DB_USER', // specify database username | |
'db_pass' => 'DB_PASS', // specify database password | |
); |
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
# file: /.gitignore | |
# Laravel # | |
/bootstrap/compiled.php | |
/vendor | |
composer.phar | |
composer.lock | |
.env.*.php | |
.env.php | |
/bootstrap/environment.php |
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 | |
//file: /app/config/local/database.php | |
// return the database configuration | |
return array( | |
'connections' => array( | |
'mysql' => array( | |
'driver' => 'mysql', | |
'host' => getenv('db_host'), // equivalent $_ENV['db_host'] | |
'database' => getenv('db_name'), | |
'username' => getenv('db_user'), | |
'password' => getenv('db_pass'), | |
'charset' => 'utf8', | |
'collation' => 'utf8_unicode_ci', | |
'prefix' => '', | |
), | |
); |
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 | |
//file: /bootstrap/environment.php | |
/** | |
* The environment enumeration | |
* local | |
* staging | |
* production | |
* | |
*/ | |
return 'local'; |
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 | |
//file: /bootstrap/start.php | |
... | |
$env = $app->detectEnvironment(function () | |
{ | |
return require __DIR__.'/environment.php'; // load the specified environment | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment