Create a .environment file in the root of your application and define your environment and gitignore it:
return array(
'LARAVEL_ENV' => 'development',
'POSTGRESQL.HOST' => 'localhost',
'POSTGRESQL.DATABASE_NAME' => 'laraveldatabase',
'POSTGRESQL.DATABASE_USER' => 'laraveluser',
'POSTGRESQL.DATABASE_PASSWORD' => '!Bassw0rT',
);
Load it in Laravel right before $app->detectEnvironment()
:
foreach(require __DIR__.'/../.environment' as $key => $value)
{
putenv(sprintf('%s=%s', $key, $value));
}
Then just use it everywhere:
<?php
return array(
'connections' => array(
'postgresql' => array(
'driver' => 'pgsql',
'host' => getenv('POSTGRESQL.HOST'),
'database' => getenv('POSTGRESQL.DATABASE_NAME'),
'username' => getenv('POSTGRESQL.DATABASE_USER'),
'password' => getenv('POSTGRESQL.DATABASE_PASSWORD'),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
),
),
);
Better than use it all in the .htaccess file, IMO.
Any reason to use this over environment configurations like here: http://laravel.com/docs/configuration#environment-configuration ?