Every web developer probably at some point heard something about MVC unless he or she was living in a cave. I definately have heard and read a lot about it. I won’t probably lie too much to say that most people know that MVC is the nowdays defacto design pattern for web applications. Atleast for PHP it is.
If you have ever had interest in design patterns and did some research on them you may know that design patterns may be interpreted and implemented different every time one tries to. And MVC is no exception to this rule. In my own career path I have seen many projects that claim to implement the MVC design pattern. And if it actually doesn’t – it may be called a hybrid of MVC. As ridiculous as it may be I think because of the MVC hype and everyone trying to be able to claim “yes we use MVC” it is one of the most misunderstood patterns of them all. And because of this … There are a LOT and i mean a LOT of articles and blogs and forums trying to explain MVC the way it should be.
And I myself have read a lot of versions of these blogs and articles. And to be honest I couldn’t answer to you for example what a controller should do and should not do. Well ofcourse I know it shouldn’t contain any business logic. If you would try to research that you would probaly find people saying that the controller should initiate the model, do something with the model and pass the result to the view and render it. You can even find some examples..
But to some extent I find it all synthetic and not very realistic. Most examples are of the level of Hello World program. I think the devil is in the details. If you would try to find any sample php mvc applications you probably wouldn’t find much. There are a few very simplistic sample MVC projects but I don’t find that to be an eye opener that goes deep into details.
I think the PHP community needs such an example. I believe Zend Framework is a great start for MVC. But it isn’t enough. It still doesn’t show you how a real life model or controller would look like. What each part of MVC would do and would not. I believe that one good example is better than a thousand words. I feel trully interested to try and find the “Equilibrium” of the famous MVC design pattern. Don’t you?
4 Comments for Sample PHP MVC application
halfer | March 31, 2009 at 3:47 PM
admin | March 31, 2009 at 4:20 PM
I would tend to disagree with that there are “loads around”. And also one should check the quality of these examples if they exist. I’ll definately take a look to Jobeet. I must admit i haven’t digged really deep trying to find Zend framework working MVC examples, but from first glance there’s not much to find.
Abhishek | November 7, 2009 at 12:54 AM
nice info dude, but i am still confused why to use mvc over conventional 3 layer archi
Žilvinas Šaltys | November 18, 2009 at 11:50 PM
Could you elaborate more on what do you mean by “conventional 3 layer archi”?


There are plenty of arguments raging over what should go where in the MVC paradigm, but I don’t worry about them. At the end of the day, the point of a framework – MVC or no – is to make the developer’s life easier for complex web projects.
If you want an example of a working MVC-based application, there are loads around – I am not sure the PHP community needs another one, though maybe more the merrier! I am a symfony fan, so would recommend Jobeet to you; however if you prefer Zend, or Cake PHP etc., there are sure to be downloadable examples for those frameworks.