PHP MVC Sample
This is a little demonstration of how MVC applications work in PHP. I wrote this code during a live demo so it's not 100% and some shortcuts were taken to speed up the development.
The idea is to give an understanding of how MVC works, not just specifically in PHP, but in general.
Installing
Installation is super-simple. Grab Composer and run composer install
in the Git repository directory.
Explanation
The idea behind this is that reading, modifying and breaking it will teach a person how to work with MVC in PHP. The comments included in it are also helpful.
As a 3-bullet-point primer, I like to think of MVC in this way:
- The Model - Concerned with data. Creating, Reading, Updating and Deleting.
- The View - Concerned with appearance. How the application looks.
- The Controller - Concerned with behaviour. How the application acts and flows.