CodeIgniter Forums
Database-sample.php - Printable Version

+- CodeIgniter Forums (
+-- Forum: Development (
+--- Forum: Issues (
+--- Thread: Database-sample.php (/thread-72841.html)

Database-sample.php - vitalykk1983 - 02-18-2019

I just interesting in one question, sorry, if it's duplicate thread, but I can't find answer.

I can't understand, why CI don't have a file database-sample.php, like others frameworks. And file database.php must be in .gitignore by default, IMHO.  It's easy to have two file database-sample.php and database.php, so why not?

RE: Database-sample.php - ciadmin - 02-18-2019

What do understand a "database-sample.php" to contain?
"database.php" would normally be git-ignored because we expect it to hold database access credentials.

RE: Database-sample.php - vitalykk1983 - 02-18-2019

For example, laravel has two files .env and .env.example, where .env contains real database credentials, email settings, etc and .env.example contains standard fake data only for sharing purposes. If I download a repository I can quickly setup project, using .env.example and then rename it to .env.
It's good approach in laravel, so I just ask what do you think about it

RE: Database-sample.php - ciadmin - 02-18-2019

Hmmm - isn't application/config/database.php pretty much what you described?
And the user guide ( goes into more details.

As it is, you only need to create an environment-specific folder underneath aplicaiton/config, and copy then tailor any config files (eg database). You might have to make sure to git ignore them.

We have done this with CodeIgniter 4, with sample files to customize (.env, phpunit.xml.dit, Vagrantfile.dist), with the tailored files already git ignored.

RE: Database-sample.php - vitalykk1983 - 02-19-2019

Codeigniter version 4 looks very and very promising. So wait for stable release Smile and thanks for all contributors for their work making the CI better