I've been attempting to understand how MVC applications are structured and have spent time with frameworks like CodeIgniter and Zend making small test websites to play around with. However I'm still unsure if I completely understand how to separate the logic properly since it still seems like it's taking more time than it's saving.
I learn best from looking at well-written code and I have a feeling there are a few talented programmers on SO.
Are there any good "Real World" examples of a PHP MVC application that I could look over? I've made the mistake of not asking about best practices and instead pick up poor coding practices in the past and I want to avoid making such a mistake moving forward.
Thanks SO!
PHP MVC is an application design pattern that separates the application data and business logic (model) from the presentation (view). MVC stands for Model, View & Controller. The controller mediates between the models and views. Think of the MVC design pattern as a car and the driver.
PHP frameworks typically follow the Model View Controller (MVC) design pattern. This concept separates the manipulation of data from its presentation. The Model stores the business logic and application data. It passes data to the View, the presentation layer.
The Model-View-Control (MVC) pattern, originally formulated in the late 1970s, is a software architecture pattern built on the basis of keeping the presentation of data separate from the methods that interact with the data.
Car driving mechanism is another example of the MVC model. Every car consist of three main parts. View= User interface : (Gear lever, panels, steering wheel, brake, etc.) Controller- Mechanism (Engine) Model- Storage (Petrol or Diesel tank)
I found this PHP tutorial to be useful when I first wanted to improve my understanding.
I'm writing an open source bugtracker, you might want to have a look. The code may not be 100% neat and clean, but it's mostly better than worse ;). http://code.google.com/p/bugraid/
A pretty good basic Zend example is http://akrabat.com/zend-framework-tutorial/
Or you could just use ZFtool to create a project a very basic program and understand how it is brought together
>zf create project <path> from within the bin directory in your zend download
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With