How can i create module within another module using gii or any other method

Please follow the below steps to resolve your issue:


[*]You need to create two modules named "MainModule" and "SubModule" using Gii.

[*]Create a folder named "modules" within the newly created module "MainModule" directory.

[*]Put "SubModule" which was created by Gii, in protected\modules\MainModule\modules directory.

[*]Then register both the modules in protected\config\main.php as below:


return array(




                        'MainModule' => array(

                                'modules' => array(

                                        'SubModule' => array(









Let me know if you face any query/concern regarding this.


Saurabh Dhariwal