Change/add database configuration inside the application

Hi guys,

I would like to remove and add database configurations in the runtime of my application. Currently I know that I can have a few databases in my configuration file (config/web.php) and switch them in my model during the runtime of my application. But I don’t want to have dozens of databases in my web.php file. I want to define a schema for my databases in a controller and pass a generated configuration array to my application after the

new yii\web\Application($this->config);

is instantiated. Has anybody a hint for me?


Just create Connection instances as you go: