Zend framework 2 article

Home >> Zend framework 2 >>

  Recommended module structure for Zend framework 2

This article will explain the module structure of the ZEND framework 2. Starting with version 2, Zend Framework made it clear that it should be implemented by modules within the application.

Zend Framework 2 uses a module system to organise your main application-specific code within each module. We are going to put all our code into the Blog module which will contain our controllers, models, forms and views, along with configuration.

Setting up the Blog module
Start by creating a directory called Blog under module with the following subdirectories to hold the module’s files:

As you can see the Blog module has separate directories for the different types of files we will have. The PHP files that contain classes within the Blog namespace live in the src/Blog directory so that we can have multiple namespaces within our module should we require it. The view directory also has a sub-folder called blog for our module’s view scripts.

Write your comment now