Support the ongoing development of Laravel.io →
IOC Architecture
Last updated 2 years ago.
0

I always commit all of my configuration files to my repository. Rather than storing sensitive information such as the database connection info in the config files, I use environment variables to store that information. My config/database.php ends up looking like this:

	'mysql' => array(
		'driver'    => 'mysql',
		'host'      => 'localhost',
		'database'  => getenv('DB_NAME'),
		'username'  => getenv('DB_USER'),
		'password'  => getenv('DB_PASS'),
		'charset'   => 'utf8',
		'collation' => 'utf8_unicode_ci',
		'prefix'    => '',
	),
Last updated 2 years ago.
0

Further reading:

https://github.com/vlucas/phpdotenv

Laravel 5 currently uses this.

Last updated 2 years ago.
0

I currently using laravel 4.2

Last updated 2 years ago.
0

Hi pbrzoski,

But you can setup this easily in 4.2:

Create .env.local.php on main directory with this content:

<? php
return [
  'DB_HOST' => 'localhost',
  'DB_UNSERNAME' => 'your_username',
  'DB_PASSWORD' => 'your_password',
  'DB_NAME' => 'your_dbname'
];
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

pbrzoski pbrzoski Joined 1 Dec 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.