In the documentation "info" section Yii 2 says:
Using too many application components can potentially make your code harder to test and maintain. In many cases, you can simply create a local component and use it when needed.
What is local component? How create it?
Local component it is just local instance of component. So instead using:
which will force you to define
cache123component in app config, you can use local instance:Or assign it to module for example:
And then in controller you can use:
You can also define components in module config:
And then in controller you can use:
In this way you can split your app into multiple independent modules with separate components. It may be easier to maintain this if you have large number of components if they're grouped in modules, especially if some of them are used only in one place or one module.