Sub-modules in Zend Framework

Following on from my post on Admin sub-modules I’ve refactored the code into a more generic sub-modules system. And fixed some bugs!

Its main features are:

  • Organise modules into sub-folders where you need to support a complex collection of controllers, views, models, etc
  • Supports URLs in the format: /sub-module/module/controller/action
  • Supports ID route: /sub-module/module/controller/action/id
  • Registers controller folder to support above URLs
  • Autoloads module resources (using Zend_Application_Module_Autoloader) in the format: submodulenameModulename_Resource (i.e. AdminUser_Form_Registration)

This supports URL routes such as: ->
application/admin-modules/user/controllers/IndexController.php ->

It’s a bootstrap resource that can be enabled in your application.ini file as so:

; 'admin' key is the name of sub-module group = path to sub-modules directory = APPLICATION_PATH "/admin-modules"

One Reply to “Sub-modules in Zend Framework”

Comments are closed.