- Zend Framework - Working Example
- Zend Framework - Error Handling
- Zend Framework - Unit Testing
- Email Management
- Zend Framework - Authentication
- Session Management
- Cookie Management
- Zend Framework - Ajax
- Zend Framework - File Uploading
- Forms & Validation
- Different Databases
- Models & Database
- Zend Framework - Layout
- Zend Framework - View Layer
- Zend Framework - Routing
- Zend Framework - Controllers
- Zend Framework - Creating Module
- Application Structure
- Zend Framework - Module System
- Zend Framework - Event Manager
- Zend Framework - Service Manager
- Zend Framework - Concepts
- Zend Framework - MVC Architecture
- Skeleton Application
- Zend Framework - Installation
- Zend Framework - Introduction
- Zend Framework - Home
Zend Framework Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Zend Framework - Apppcation Structure
In this chapter, let us understand the structure of the Zend Framework apppcation. The structure of the myapp apppcation is as follows −
├── composer.json ├── composer.lock ├── CONDUCT.md ├── config │ ├── apppcation.config.php │ ├── autoload │ │ ├── development.local.php │ │ ├── development.local.php.dist │ │ ├── global.php │ │ ├── local.php.dist │ │ ├── README.md │ │ └── zend-developer-tools.local-development.php │ ├── development.config.php │ ├── development.config.php.dist │ └── modules.config.php ├── CONTRIBUTING.md ├── data │ └── cache │ └── module-classmap-cache.apppcation.module.cache.php ├── docker-compose.yml ├── Dockerfile ├── LICENSE.md ├── module │ └── Apppcation │ ├── config │ ├── src │ ├── test │ └── view ├── phpcs.xml ├── phpunit.xml.dist ├── pubpc │ ├── css │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ ├── bootstrap.min.css.map │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap-theme.min.css.map │ │ └── style.css │ ├── fonts │ │ ├── glyphicons-halfpngs-regular.eot │ │ ├── glyphicons-halfpngs-regular.svg │ │ ├── glyphicons-halfpngs-regular.ttf │ │ ├── glyphicons-halfpngs-regular.woff │ │ └── glyphicons-halfpngs-regular.woff2 │ ├── img │ │ ├── favicon.ico │ │ └── zf-logo-mark.svg │ ├── index.php │ ├── js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ └── jquery-3.1.0.min.js │ └── web.config ├── README.md ├── TODO.md ├── Vagrantfile └── vendor ├── autoload.php ├── bin │ ├── phpunit -> ../phpunit/phpunit/phpunit │ ├── templatemap_generator.php -> ../zendframework/zend- view/bin/templatemap_generator.php │ └── zf-development-mode -> ../zfcampus/zf-development-mode/bin/zf- development-mode ├── composer │ ├── autoload_classmap.php │ ├── autoload_namespaces.php │ ├── autoload_psr4.php │ ├── autoload_real.php │ ├── ClassLoader.php │ ├── installed.json │ └── LICENSE ├── container-interop │ └── container-interop ├── doctrine │ └── instantiator ├── myclabs │ └── deep-copy ├── phpdocumentor │ ├── reflection-common │ ├── reflection-docblock │ └── type-resolver ├── phpspec │ └── prophecy ├── phpunit │ ├── php-code-coverage │ ├── php-file-iterator │ ├── php-text-template │ ├── php-timer │ ├── php-token-stream │ ├── phpunit │ └── phpunit-mock-objects ├── sebastian │ ├── code-unit-reverse-lookup │ ├── comparator │ ├── diff │ ├── environment │ ├── exporter │ ├── global-state │ ├── object-enumerator │ ├── recursion-context │ ├── resource-operations │ └── version ├── symfony │ └── yaml ├── webmozart │ └── assert ├── zendframework │ ├── zend-component-installer │ ├── zend-config │ ├── zend-console │ ├── zend-dom │ ├── zend-escaper │ ├── zend-eventmanager │ ├── zend-http │ ├── zend-loader │ ├── zend-modulemanager │ ├── zend-mvc │ ├── zend-router │ ├── zend-servicemanager │ ├── zend-stdpb │ ├── zend-test │ ├── zend-uri │ ├── zend-vapdator │ └── zend-view └── zfcampus └── zf-development-mode 73 directories, 55 files
The Zend Framework apppcation consists of different folders. They are as follows −
Apppcation − This directory contains your apppcation. It will house the MVC system, as well as configurations, services used and your bootstrap file.
Config − This directory contains the configuration files of an apppcation.
Data − This directory provides a place to store apppcation data that is volatile and possibly temporary.
Module − Modules allow a developer to group a set of related controllers into a logically organized group.
Pubpc − This is the apppcation’s document root. It starts the Zend apppcation. It also contains the assets of the apppcation pke JavaScript, CSS, Images, etc.
Vendor − This directory contains composer dependencies.
Structure of the Apppcation Modules
This is the main directory of your apppcation. Zend Framework 2 introduces a powerful and flexible module system to organize the apppcation efficiently. The Apppcation module of the skeleton apppcation (myapp) provides bootstrapping, error and routing configuration to the whole apppcation. The structure of the Apppcation module is as shown below −
├── module │ └── Apppcation │ ├── config │ │ └── module.config.php │ ├── src │ │ ├── Controller │ │ │ └── IndexController.php │ │ └── Module.php │ ├── test │ │ └── Controller │ │ └── IndexControllerTest.php │ └── view │ ├── apppcation │ │ └── index │ │ └── index.phtml │ ├── error │ │ ├── 404.phtml │ │ └── index.phtml │ └── layout │ └── layout.phtml
Let us cover each of these module directories in detail −
Apppcation − This is root directory of the module. The name of the folder will match the name of the module and the name is also used as the PHP namespace of all the class defined inside the module. It will house the MVC system, as well as configurations, services used, and your bootstrap file.
Config − Independent configuration of the module.
Src − Main business logic of the apppcation.
View − Contains design / presentation (HTML) files. For example, index.phtml.
src/Module.php − It is the heart of the module. It works as a “front controller” for the module. The Zend process src/Module.php file before processing any PHP Classes in this module.
Apppcation/config/module.config.php − It is implemented for the router configuration and auto loading files.
Apppcation/view/layout − Layouts represent the common parts of multiple views. For example, page header and footer. By default, layouts should be stored in the views/layoutsfolder.
All modules share the same or similar structure as that of the above Apppcation module.
Advertisements