The Importance of MVC Frameworks for Developing PHP Web Applications

PHP is an application development platform. It provides services for interacting with databases, handling emails etc. Because of its flexibility and strength, it is not that difficult to start coding application.

What is framework?

Coding in core PHP can work but you can end up with untidy code. Long lines of code that have multiple unwanted interactions and typically they HTML code within them. It is simple to write code in core PHP that is to have multiple files to do the same thing. When you want to update something then you are going to end up having to change multiple files for things to work correctly. Without any form of organization it is easy to have files here and there but you will never know how your application is organized. In this way, it can be difficult to reuse the code. If you make changes in one part of code, there is always possibility that you will break another thing somewhere else. Everything need to be tested again and again every time you make any change.

Frameworks can help here. More than anything, they provide a platform for creating clean and organized code. When your code is organized, it is easy to test each individual piece of code against test cases. Also its’ east to make changes. Changing a small php function will update functionality throughout application. In most of  frameworks, many pre-built and pre-tested tools included.

Ultimately, frameworks lead to better organization of code, which in most cases can make or application development experience less painful.

Should I always use framework?

You don’t necessarily need to. For smaller applications, breaking up code can end up meaning lot of steps even for minor functionality.


At the core of every framework is the concept of patterns or architectural patterns. Patterns are simply abstract ways to organize your programming. MVC is one of the most basic pattern that id user by every framework.

MVC stands for Model / View / Controller. This pattern is all about breaking down application into 3 parts:

Model – Data Layer

View – User Interface layer

Controller – Interacts with Model

MVC Process

At view layer, there will be user interface. Typically this is going to result in HTML or HTML 5.

The user interface is the view layer and when the user interacts with it, say they click on a button to add an item to the shopping cart, this will then send input to the controller, either through a JavaScript handler or possibly through submitting a form or sending it to a URL.

If necessary, the controller will update the model. It will notify the model of the changes and this can then update it. In our shopping cart example, the controller would essentially add an item to a shopping cart data in the session.

The view can then go back and query the model data if it wants to display it, for example, shows a user what’s in the shopping cart. Notice that the pattern doesn’t dictate how this is done.

The model layer will handle the data, the view layer is going to generate the user interface, and the controller is going to handle the interactions.

There are many popular frameworks like ZEND, SYMFONY, CODEIGNITER, CakePHP.

Elements need to be considered before deciding which framework to use:

-’Weight’ of framework



-Community Support





This entry was posted in Web Application Development and tagged , . Bookmark the permalink.

Comments are closed.