Join Drew Falkman for an in-depth discussion in this video Understanding MVC: Model-View-Controller, part of MVC Frameworks for Building PHP Web Applications.
- At the core of every framework, is the concept of patterns or architectural patterns. Patterns are simply abstract ways to organize your programming. One of the most basic patterns, and one used by all the frameworks we discuss in this course, is called MVC. MVC stands for Model-View-Controller, and this pattern represents the concept of breaking down your application into three coherent parts: the Model, or Data, layer, the View, or User Interface layer, and the Controller which mediates user interface interactions and updates to the Model.
The View can then query the Model's data, to display it. For example, to show the shopping cart. Notice that the pattern does not dictate how this is done. Each framework will divide it up in a slightly different way. If you aren't using a framework, it will be tempting to have all this handled in the same PHP page, or even to have the add-to-cart functionality written into the catalog page, and the product detail page. This is basically the core of the frameworks we discuss in this course. What changes, is really just where the parts are stored, and other patterns and coding practices that are also embedded into the framework.
The PHP frameworks we'll be looking at all rely on the MVC, or Model-View-Controller, pattern for their code oganization. Using this pattern, applications are broken into cohesive parts. The Model layer, to handle the data, and interact with the database, the View layer, to handle the User Interface, and the Controller, which responds to interactions going both ways. This pattern generally works well to create an application that's well-partitioned, and thus easy to test, maintain, reuse, and work on in a team environment.
- Why use a framework?
- Introducing MVC-framework concepts
- Examining each framework's components
- Setting up the software
- Walking through sample apps built in each framework
- Comparing frameworks