Model View Controller Pattern and PHP

Original article MVC Pattern (Version 2) only provide the new example code to download. I just add to the article the content of the two modified classes, View and Controller (Model and DataAccess classes are left unchanged) and some of the original comments.

This is an updated version of the Model View Controller pattern which attempts to adhere more stringently to the definition of that pattern.

The first version of this PHP pattern can be found here. Thanks to some useful comments, I’ve updated it now to be closer to the widely accepted definition of an MVC pattern. This article updates the code while leaving the earlier article to give an overview of the concepts.

As an interesting side note, ran into Phrame today : a port of the Jakarta Struts project to PHP, which provides an excellent means for achieving “looser” coupling between Model and View (loose coupling ?).

UML wise we’re now talking

MVC révisé

I’ll leave it otherwise for the code to explain itself, so we can move on to other things...