I'm not satisfied by the Symfony Dotenv default behaviour, because I would like to have i.e. a .env.override
which would override existing environment values.
So I would like to add the following code in config/bootstrap.php
$envLocal = dirname(__DIR__).'/.env.override';
if (file_exists($envLocal)) {
(new Dotenv(false))->overload($envLocal);
}
Is it a problem to edit this file (config/bootstrap.php
)? Can it be erased by future Symfony updates?
You can modify bootstrap.php
to your heart's content.
The file is created when you run create-project symfony/skeleton
, but it's part of your application files (it's not a dependency), so it's your responsibility to maintain it, and use it as you see fit.
Actually, if you upgraded your application to a version of Symfony that expected a different behaviour of bootstrap.php
(or public/index.php
, or (bin/console
) you may need to update these files (among others).