Using ZF Tool to Create a Modular Zend Framework Application
This is just a quick guide on creating a modular application structure in the Zend Framework using the Zend Framework Tool (more or less).
First move to your directory.
Now create the project
zf create project MyApp cd MyApp
Now that we have a functioning app. The next step is to turn it into a modular application. First we remove the controller and view directories then we create our first module with its controller, action, and view.
rm -rf application/controllers/ rm -rf application/views/ rm -rf application/models/ zf create module default zf create controller Index 1 default
Now that we have our default controller with a index controller and index view, were almost there. The system isnâ€™t yet setup to use the modules so the last thing we need to do is edit the application configuration file. In the application config you will make the following change
; Remove this line from your current application.ini resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" ; Add this line in its place resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
This is the process that I currently use. I’m sure there is a much easier solution to this but I haven’t found it. Please let me know in comments if you know of a better way.