Hey everybody, I've been working with PHP for a few months now and have come pretty far... and am starting some pretty big projects using Object-Oriented PHP design patterns.

I've learned a bit about the Model-View-Controller and decided to sort of make it with twist. Before I started implementing it in several big apps, I was wondering if anybody could give their opinion if they think it's good... anyway, here's a quick run down.

My php apps use a MVC design pattern. The top dog of the application which practically controls every aspect is a php class called the AppController, which is instantiated by going to a php file (example- someting.com/app.php). Upon creation of an AppController, it automatically grabs and processes all variables passed in the URL - it analyzes the names and values and uses an extensive branching of switch/case structures to figure out what needs to happen.

Once the request is processed, the AppController will create a DataController and a ViewController. DataController calls the "model" classes (for example - article.data.php would be a ArticleData class which will retrieve all data for a blog article) and returns the data to the AppController. When this data is returned, AppController uses teh ViewController to generate the final HTML/CSS/etc page. ViewController is passed the data from DataController and then calls on a "view" class (example - article.view.php) that is a mix of php code and html which will insert the dynamic data from DataController.

So, do you think this is a good way to develop really big apps (like a project management app that might be 10,000 + lines of code)?

I've used it on several medium-sized apps and find it awesome - it seem very quick and easy to manage. Plus, I can reuse the App,Data,ViewControllers (just change some of the logic and function/variable names). THe only thing I need to uniquely create are the data model classes (not hard at all) and the view classes (which is usually copy+paste HTML from the mockup template and a bit of data injection here or there.

Is this a good approach? Efficient at runtime? Thanks for the advice. I greatly appreciate it :)

There are many MVCs around so first off I'd suggest you take a look at those since they've had years of development and large teams behind them (Zend Framework, Code Igniter, Symfony, Cake, etc.) Though, obviously, the large, more feature-rich the framework the slower it will be (ie., Code Igniter is faster than Symfony but not as feature-rich)

Thanks your thoughts! I've looked into some of these frameworks and have decided to do a custom one. I know that these have way more refinement, but I find that when I develop PHP apps I like to know exactly what every line of code does... rather than looking up the documentation of some huge framework and just using it without knowing every aspect.

Also, performance will be a big issue in the future of one of the apps i am planning so I'd like to have a codebase that is everything I need and absolutely no "fat".

I'm just wondering if this sounds like a good start (I'm relatively new to the OOP side of PHP so... just wanted to throw this out there.)

Personally, I use Symfony and it is without a doubt the most well documented piece of software I've ever developed for/in. I can't speak for the other frameworks but Cake and Code Igniter have followings. The Zend Framework is supported by Zend ( the people behind the Zend Engine that drives PHP ). If you do decide to create your own I would advise you to develop it in a stable, isolated environment during development, MVCs are pretty complex so my hat is off to you as a first whack at OOP.
Good Luck. Maybe start a Daniweb blog to keep us updated :)

This article has been dead for over six months. Start a new discussion instead.