Auto-Configure Extensions With Bootstrap()

I’ve just read [size=“2”]http://www.yiiframew…-with-extension and asked myself, if the bootstrap feature could be used to auto-configure extensions. [/size]

[size="2"]In example, could a module automatically register itself and its migrations?[/size]

Or should this be done manually for some reasons?

This is exactly what bootstrap should be used for.

For migrations we have to check whether it works as expected.

So, I tried this which works very well, but what would happen, if I install two modules which would i.e. use "user" as their module ID?

Could I reconfigure one of them?

Is it possible to regenerate "vendor/yiisoft/extension.php" somehow?

Are the some DOs and DONTs in the docs?

I noticed, that you can’t register a module from the module itself (in a bootstrap() method), but from a different class.

The bootstrap classes are executed for EVERY request.

Why would you want to regenerate extensions.php? The file is automatically regenerated each time you install/uninstall/update a composer package.

[size=2]I tried to debug an extension with a new extra:“bootstrap” and so I couldn’t remove or update this one.[/size]

[size=2]But [/size][size=2]I think it’s OK then, it was about testing the registration of the gii command …[/size]