Support the ongoing development of Laravel.io →
Installation Configuration
Last updated 1 year ago.
0

for configs i use .env.development.php. my file looks like the following

<?php
return [
  'ENV'             => 'development',
  'DB_USERNAME' => 'db_dev_username',
  'DB_PASSWORD' => 'db_password',
  'DB_NAME'          => 'dev_db'
];

inside this file i have my database settings. then i create /app/config/development folder. inside that is settings i want running. i would have a database.php file in there and it looks like

return array(

  

  'connections' => array(

    'mysql' => array(
      'driver'    => 'mysql',
      'host'      => getenv('DB_HOST'),
      'database'  => getenv('DB_NAME'),
      'username'  => getenv('DB_USERNAME'),
      'password'  => getenv('DB_PASSWORD'),
      'charset'   => 'utf8',
      'collation' => 'utf8_unicode_ci',
      'prefix'    => '',
    ),
    
  ),

  

);

/bootstrap/start.php - it has this inside it. if it can't find the value of ENV, it defaults to development.

$env = $app->detectEnvironment(function()
{
  return getenv('ENV') ?: 'development';
});

laravel should come with .gitignore that includes an entry for the .env.* files so it won't push it. on your production server, you can create a .env.production.php that has configs for your production. that should get you going.

Last updated 1 year ago.
0

Interesting. Thanks for the reply. The only thing in the Laravel .gitignore is:

/bootstrap/compiled.php
/vendor
composer.phar
composer.lock
.DS_Store 
Thumbs.db
Last updated 1 year ago.
0

my .gitignore has those and these as well...

app/config/local
app/config/development
.env.*.php

along with other IDE related stuff. i add the development folder just so that other devs in my team don't get their environment files screwed up with mine and vice versa. there are many ways to set up your dev environment. we checked around the internet for examples and we customized it to our environment. but the important thing is you should have a dev and production environment. another thing i can add is we use 2 branches on bitbucket. we use the master branch but we also use a "development" branch. whenever we finish a version, we test it. if all looks good, we migrate onto "master" then we deploy that onto our production server. it took us about 5 weeks of trial and error to get the "right" mixture. we're still playing around with other techniques but for the most part, we've figured out good combination for our dev style and environment.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ChrisF79 chrisf79 Joined 11 Feb 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.