What is main difference between Modules and Extensions? I know Module is like a small application in our application and Extension is like a feature to show ready to use feature, but I don’t know where to use each one! Would you please give me some example of each uses?
Because extensions are redistributable and installable - in other words: packaged.
Take the Gii extension. That is a module, actually, but packaged as an extension so that it can be installed.
So, extensions are things that can be reused/shared.
They would be Composer packages that can be hosted on Packagist, but they also can make use of the special Yii2 Composer extensions that allows Yii to bootstrap them, etc.
Check out the source code for the Gii extension - you should have it in your vendor directory. vendor/yiisoft/yii…
I hope that answers your question.
I haven’t used the Gii extension tool myself as I prefer to do it manually, but I probably should.