Whenever I’ve read about projects or people advocating the use of a Model-View-Controller framework for a php-driven web site, I’ve always gotten a hunch that its an overly-big hammer to use for your typical website. While the theory of its use may make sense for a desktop client application, I’m not convinced it fits for a website where what you are doing is sending pages of content to a browser. Other people seem to share this viewpoint. See Web Applications: still no ideal architecture… which links to the more interesting The Mountain of Worthless Information who writes:
At the end of the day, we need to stop pretending that the Web browser is just an extension of the desktop, and recognize it for what it really is: the old mainframe terminal, gussied up by lots of colors, graphics, and better fonts. Treat your web apps as we did terminal-based apps 30 years ago, and you’ll find your system behaves a lot better as a result.
On a related note, while the MVC pattern may not work for a php webpage. There’s no reason not to use a Frontcontroller. The WACT project’s page on FrontControllers is a handy reference for all the different ways you can register such a script on Apache including: Physical mapping, using mod_rewrite, and using the ErrorDocument directive.
Turns out all this time when I’ve been coding I’ve been using FrontControllers, I just didn’t know it. I see some interesting ways I can automate what I’ve been writing to create a simple, reusable front-controller script.