Build an MVC Framework with PHP

PHP now enables you to build robust, manageable, and beautiful enterprise web applications. The best way to do that is to divide the application into three components: model, view, and controller. In other words, you need to separate the presentation, the database, and the business logic from each other. The most common approach for achieving this design goal is to adhere to a strict Model-View-Controller (MVC) framework.

The greatest advantage to separating the application into discreet components is that you end up with software that doesn't scare fellow developers. Instead, you create an application that developers can be update, tweak, and manipulate without requiring major rewrites and aggressive re-factoring. The MVC architecture also will greatly improve your relationship with the marketing and business development departments, because they always want to make changes and with a well-designed application you can accommodate them.

The most effective way to build a PHP application based on the MVC design pattern is to leverage the power of a templating system such as Smarty for the Viewer, a PostgreSQL database as the Model, and object-oriented PHP classes as the Controller. This article demonstrates such an MVC framework by walking through the steps for building a simple newsreader called Amalgamate.