Book Image

Learning Phalcon PHP

Book Image

Learning Phalcon PHP

Overview of this book

Table of Contents (17 chapters)
Learning Phalcon PHP
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The MVC structure


This subject (like many other subjects) is quite sensitive. It depends on how much experience you have and how you are used to structure your projects. In a web application, most of the time we have models, views (templates), controllers, and assets (images, JavaScript files, and style sheets). Based on this, I like the following structure, because it's easy to understand where a file resides and what its purpose is.

For a single module application, we can have the following structure:

For a multi-module application, we can have the following structure:

As you can see, it is quite easy to know exactly what a file is used for and where we can find it. In the end, you should choose the structure that fits your needs but keep in mind that if you are going to work in a team, it should be intuitive enough for any new member.