I'm sure that someone already posted this question; however, I would like to get all kind of recommendations for MVC on PHP. I know there are many experts out there willing to share their knowledge with people who has doubts about their coding best practices.
Hope this helps someone out there (because it'll help me for sure).
For php, I like to use the CodeIgniter framework. It lays the ground work for the MVC set up. The controllers are held in "/controllers" and models are in "/models"
I believe that a controller should call the model and the model should encapsulate as much as it can, using submethods if needed. This makes your code much more adaptive and flexible. Example, today your model is reading from a local database, tomorrow you could be reading from a REST service. The model should return data to the controller and the controller should be naive to what is going on inside of the the model.
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