Yii2 routes definition in modules

后端 未结 3 826
太阳男子
太阳男子 2021-01-12 19:20

Is there any solution to add routes from module configuration?

Example. We have main config where we describe

\'components\' => [
    \'urlManage         


        
3条回答
  •  北海茫月
    2021-01-12 20:03

    Separating url rules for modules is mentioned in official documentation here.

    And I think this is more optimum approach unlike merging and declaring all rules in one config file.

    The rules are parsed in order they are declared (this is mentioned here), so with the separation you can skip other modules urls. In case of large amount of rules it can give perfomance boost.

提交回复
热议问题