Hi there.
Can I ask for help.
I have set up a .env file with mysql creds.
I am looking to pull this into config\settings.
I do not see how this is done in Slim 4 framework.
Also I see config\env.example.php but this asks for the username and password to be hard coded.
Below is what I see in Slim 4 framework: config\settings. I.e. I want to get away from hard coding my password and username for the mysql settings.
Hope you can help. Thanks in advance.
<?php
// Detect environment
$_ENV['APP_ENV'] ??= $_SERVER['APP_ENV'] ?? 'dev';
// Load default settings
$settings = require __DIR__ . '/defaults.php';
// Overwrite default settings with environment specific local settings
$configFiles = [
__DIR__ . sprintf('/local.%s.php', $_ENV['APP_ENV']),
__DIR__ . '/env.php',
__DIR__ . '/../../env.php',
];
// Database settings
$settings['db'] = [
'driver' => 'pdo_mysql',
'host' => 'localhost',
'dbname' => 'slimapp',
'user' => 'myusername',
'password' => 'mypassword',
'charset' => 'utf8mb4',