Monday, July 15, 2013

Understanding Directory Structure in ZF

When we create new project in Zend, it creates directory structure for us. On right side image, full directory structure of ZF application is shown.

This structure has four main area, application, library, public, and tests.

Application Directory: Is responsible for holding our application-specific files such as configs, controllers, models, and views. These are basic in any zend framework application,  in some zf application there is modules directory, holds different modules required for application. So, This application directory contains main MVC files.

Library directory: Is responsible for holding our supporting classes that not come into the scope of model. Inside library, we have the zend directory that contains the ZF source files.

Test directory: Stores our tests for our application.

Public directory: Is responsible for holding all of our publicly accessible assets such as images,CSS, and JavaScript.


Bootstraping [Bootstrap.php]:  This refers to the process of application initialization where we configure, and startup, the MVC process when someone requests a page.

The Index file [index.php]: This file is created under public directory, which is the main entry point for all of the requests to our application. This file points to application, library directory and application environment of application.

.htaccess file: This is important file in application, that rewrites rules for routing.

Application Configuration [application.ini]: This is most important for zf application. This is heart of application. Because, it contains all configurations about our application like php_errors, database connection, & path application, controller, library directory and all routing mechanisms are written here.