[REQ][php-slim4] Move config to a separate file
Created by: ybelenko
Is your feature request related to a problem? Please describe.
I've used current Slim4 server in my personal project and I think that config file should be extracted from index.php
. The most suitable format is config.inc.php
.
Describe the solution you'd like
I'll add config
folder with example.inc.php
. User should copy that file to prod.inc.php
and dev.inc.php
. I prefer config.inc.php
format over .env
and .ini
because these formats can be used only for flags or string variables. So config.inc.php
file is the only way if you need to specify callback:
return [
'getPDOConnection' => function () {
return new PDO('mysql:dbname=dbname;host=localhost;charset=UTF8', 'root', 'root');
},
];