Main Content

Zend / layout of MVC and other files in an example application (PHP)

Archive - Originally posted on "The Horse's Mouth" - 2012-12-16 15:07:44 - Graham Ellis

Under the Zend Framework, all URLs get mapped to mvc.php which in turn acts as the router. There are separate directories / folders for code in each of the
• model
• view
• controller
and a wide variety of configuration files and libraries used too.

Here's a diagram showing the layout of the various files and folders within an example application that I'll be using this week - things may vary on your own applications (and with the shift from level 1 to level 2 in the framework), but the diagram is still a useful overview.




The diagram is available larger in the archived version of this article - click [here].

Summary of some major locations:
a) The Web application home directory
  /mnt/hgfs/workspace/exampleapp/webapp/htdocs
b) Model, view, Controller code
  /mnt/hgfs/workspace/exampleapp/webapp/php/modules/exampleapp
c) Configuration for the webapp
  /mnt/hgfs/workspace/exampleapp/conf
  /mnt/hgfs/workspace/exampleapp/static/conf

And general stuff:
c) Web server configuration
  /etc/httpd/conf.d
d) Other client libraries to contact back end services
  /usr/share/php