PHP Frameworks have been receiving a lot of attention in the past few years from the web development community. What’s this hype all about?
If you look at PHP Job listings, you will often see “MVC Framework Experience” as one of their requirements. It is becoming one of those must-have skill sets for web developers.
There are pretty good reasons behind all of this. In this article we will explore why you, as a PHP programmer, should be using a PHP Framework.
1. Code and File Organization

Just because you created an “/inc” folder and made a “functions.php” file does not mean your code is organized.
When you setup a PHP Framework, it already has a certain folder structure. It is expected from you to follow the same standards and keep everything organized in a certain way.
Once you get used to this model, you will never want to go back.
Unfortunately for some command line champions that still use vi, this can be a challenge. You will need to work with more files, that are smaller in size. But when you use a decent modern code editor or an IDE, it will be a breeze to browse through your application code and find what you need, quickly.
2. Utilities and Libraries
PHP is a great language for web development and provides countless number of tools and libraries.
However, if you ever try to build a whole website with PHP alone, you will find yourself either hunting down a lot of 3rd party code and libraries, or have to write them yourself.
All top PHP frameworks come with certain Libraries and Helpers, that help you with:
- Form Validation
- Input/Output filtering
- Database Abstraction
- Session and Cookie Handling
- Email, Calendar, Pagination etc…
The list goes on. Not to mention, there is plenty of plugins provided by the community that you can add to your framework.

3. The MVC Pattern
The famous Model View Controller Pattern dates all the way back to 1979, when a guy named Trygve Reenskaug (a Norwegian computer scientist) first described it.
PHP itself works like a template engine. However, when used irresponsibly, it leads to very ugly and unmaintainable code.
The way the MVC Pattern applies to PHP applications:
- Models represent your data structures, usually by interfacing with the database.
- Views contain page templates and output.
- Controllers handle page requests and bind everything together.
This kind of separation leads to cleaner and more maintainable code.
4. Security
In PHP you can already find many input and output filtering functions to protect your website against certain attacks.
However, manually using these functions can get tiring and you may forget about them every once in a while.
With a framework, most of the work can be done for you automatically. For example in CodeIgniter:
- Any value passed to database object gets filtered against SQL injection attacks.
- All html generating functions, such as form helpers and url helpers filter the output automatically.
- All user input can be filtered against XSS attacks.
- Encrypting cookies automatically is only a matter of changing a config option.
5. Less Code & Faster Development
There is of course a learning curve for all PHP Frameworks. But once you get over this hump, you will enjoy the benefits of rapid application development.
You will write less code, which means less time spent typing. You will not have to chase down 3rd party libraries all the time for every new project because most of them will come with the default framework install.
Also, since you are being more organized, it will be much faster to chase down bugs, maintain code, and make changes to existing code.
6. Community Support

All popular PHP Frameworks have great active communities behind them. You can talk to other developers, get help, feedback and also give back to the community yourself.
There are message boards and mailing lists… You can also learn a lot by just browsing the forums and look at what other people are talking about.
7. Job Opportunities
Have you looked at any PHP Job postings lately? Most of them require experience with either Frameworks or a CMS. Follow the demand!
Example from Careerbuilder.com:

Experience with PHP Frameworks greatly increases your job qualifications as a web developer.
8. Performance Tools
One of the main arguments from the naysayers comes in this subject. There is obviously a performance hit when you build a “Hello World” application with a framework vs. plain PHP code.
But those benchmarks are just bad examples. First of all, you should understand that developers are more expensive than servers. Saving time from development and maintenance is likely to outweigh any extra money you need to spend on servers.
Putting all of that aside, you can actually gain performance benefits by using a PHP framework. They come with tools that help you do caching, benchmarks, profiling etc…
Modern frameworks are also great with dynamic loading, as they load code only as needed. Different page requests can load different amount of library code based on what needs to be used.
9. Suitable for Teamwork
The way your project is organized in a PHP Framework also helps you create a suitable environment for teamwork.
You can let your designers work on the Views, database guru work on the Models, let the smart programmer (yourself
) build reusable Libraries and Plugins etc…
Also you can let someone build unit tests, because they come with tools for that too.
10. And It’s Fun!
This might actually be most important point of all. When you have fun doing your work, you will be more productive and happier in general.
If you have been coding plain old PHP for years, and getting really bored with it, getting started with a Framework can give you that crucial morale boost you have been lacking.
It’s like getting a new toy, and being able to build cool things with it. At least that’s how I felt when I first got started with Frameworks. I’m sure many of the web developers have gone through similar experiences.
Conclusion
Using a PHP Framework may or may not be the best choice for you. However, you should always keep an open mind and keep up to date with all the new developments in the web development world.
Frameworks are cool and hot today, and we can’t tell what tomorrow is going to bring. I guess all I’m saying is that they are definitely worth looking into.
#1 by Ron Oerlemans on November 6th, 2009
| Quote
Great arguments to use a PHP Framework. I recomment CodeIgniter for the beginner and Zend Framework for the advanced programmers. But I’m still a mid-advanced programmer.
#2 by 3m masr on November 6th, 2009
| Quote
i really love CodeIgniter but i wanna some resources about linking it with Jquery , doctrine and Smarty .
i found a post here about CI and Doctrine that i hope you complete very sooooon .
thanks again !
#3 by bl4z on November 7th, 2009
| Quote
number one should be productivity boost // but it’s kinda sum of all reasons
#4 by mary on November 7th, 2009
| Quote
Thanks for this post, very true that using a framework will make you more efficient and organized.
I’m deciding between frameworks and very inclined towards Zend or Kohana, but I really like your CI posts too.
thanks for sharing.
mary
#5 by Stelian Andrei on November 14th, 2009
| Quote
I see there are a lot of CI fans around here. Including myself. I love the way that I can set it up very easily for small project. I haven’t had any large project as of yet, but I assume Symphony would be more suitable for those, from what I read anyway.
@3m masr: I don’t know about doctrine but I think CI had a special user contributed library for smarty. You could probably find it in the wiki. And using jQuery is as easy as with any other HTML page. Just include the script and code away
#6 by Miguel on November 14th, 2009
| Quote
Thanks for the arguments
now i know why i chose Yii
#7 by noname on November 15th, 2009
| Quote
I have written my very simple website framework, after i have written a C# app for it to generate php code
#8 by Marcel Marnix on November 28th, 2009
| Quote
The Fun factor works for me!
I am still in a learning curve, but after I’ve tried Zen, Smarty, Symfony etc. I realy like CI and netbeans, I am having so much FUN with my new toys
#9 by Zoran on January 9th, 2010
| Quote
I started with CakePHP, did one simple project, but then i ran into problems understanding the framework itself, so i switched to CodeIgniter and learned lots of PHP along the way. I really like the structure of CI and how it handles the MVC pattern. Lately i started another project and implemented Doctrine (thanks to you) and whole Zend Framework into the CI’s library folder. I found out that Zend is way more professional coding than other frameworks, but CI is one of the most flexible allowing you so much freedom as developer, so you can still have the CI’s base and include the Zend standalone package. This way you let the Zend deal with the backend and CI with the presentation.
As an experienced PHP developer i strongly recommend using CI as your first framework then you will understand other frameworks quite easier.
#10 by Fernando on January 29th, 2010
| Quote
… and Hacker attack !!!
#11 by aditia on February 12th, 2010
| Quote
my own reason is you don’t have to repeat what you have done, except you have your own framework, but i don’t.
ya ya i start with cakephp and then codeigniter and now trying to explore kohanaphp
#12 by merry on February 22nd, 2010
| Quote
I know ,but i chose java
#13 by David on April 7th, 2010
| Quote
“If you have been coding plain old PHP for years, and getting really bored with it, getting started with a Framework can give you that crucial morale boost you have been lacking.”
That’s exactly where I was at. Although I’ve been happy with my growth over the years (building a pseudo framework for the intranet system at work), when looking into CI I’ve been having a ball doing the CI From Scratch series. Just not having to do so much stuff by hand and being able to deploy a full-blown environment to build off of in minutes is really exciting.
Great article
#14 by spiky on April 27th, 2010
| Quote
hello….what php editor use?
#15 by evan on May 3rd, 2010
| Quote
1. Although file and folder structures keep code and other stuff organized, I don’t see why a framework should impose its own structure on me. Organization and obtrusiveness are common among existing frameworks.
2. When a framework allows PHP code in views and templates, there’s no guarantee MVC will be enforced. “Clean” and “maintainable”?
3. Less code and faster development? Duh. Maybe if you get past the steep learning curve first.
#16 by murat on May 17th, 2010
| Quote
I used and completed few projects with CakePHP and Zend Framework. They are pretty good in development phase, but problem is if you need performance, php itself is enough for it so frameworks will reduce performance. Now im not using a single class because performance rules. But probably i will return to precious ZF
#17 by Jordan on May 21st, 2010
| Quote
I don’t know if you have ever used vi but having small files in directories is not a challenge.
Pingback: PHP Resources | The Michaeldon Roareth! - Mad rantings of an undiscovered dinosaur
#18 by Brett Widmann on November 4th, 2010
| Quote
This is a good set of tools and tips you have here. I liek PHP because it does have great organization and its generally pretty easy to use.
#19 by Phil Sturgeon on August 17th, 2011
| Quote
Using a framework for projects – especially when doing freelance work – is pretty much standard these days and 90% of jobs you go for will expect an understanding of at least one major framework whether you’ll be using it day-in-day-out or not.
Frameworks like Rails and CakePHP are often considered faster but their automagic often gets in the way. Boil down a framework to its architecture and its collection of classes and you have a framework like CodeIgniter or Fuel, which are both designed to help you write write less code faster, without forcing you down the line of conventions and headaches.
Pick a framework that makes sense to you, that can be extended and overridden and that has a good collection of plugins. Thinks like the GetSparks,org project for CodeIgniter makes it a powerful player in the framework industry as it means addons can be included with a single command. Expect to see that rolled into CodeIgniter soon.
Trackback: everything about java
#20 by Luufy on December 20th, 2011
| Quote
Thanks a lot for the list. I definetly start to learn CI after reading this article. I know it will take some time get used to it but the result will worth I guess.
Trackback: online articles
#21 by deepak bajpai on March 25th, 2012
| Quote
great research from you People , good knowledge base
#22 by N Singh on November 2nd, 2012
| Quote
I have worked on zend, cake and CI… my rating is 1. CI 2. Zend and 3. CakePHP
#23 by Shan on January 15th, 2013
| Quote
CI is the best one for big projects.
Pingback: Why Frameworks ?!!! « Fun Developer Notes
#24 by Marcello Cannarsa on February 1st, 2013
| Quote
I’ve worked with zend , ci, & yii framework and I study doctrine orm.
Pingback: Codeigniter PHP Framework – How to Organize Controllers to Achieve DRY Principles | Casey Flynn
#25 by Anna Harris on February 25th, 2013
| Quote
I always use PHP frameworks because it provides useful techniques for users and developers, also provide search engine friendly URL schemes.
Pingback: What Happened when we Talked PHP with the Experts - SitePoint
Pingback: What Happened when we Talked PHP with the Experts - Free Nulled Script
Pingback: What Happened when we Talked PHP with the Experts « Uncategorized « The PHP Blog
#26 by Arun G on April 21st, 2013
| Quote
Nice post, after hearing to you all heading towards learning CI.. any good material, or quick start guide would be appreciated.
#27 by rony on April 26th, 2013
| Quote
If you are a beginner and searching for best php framework you should first know what exactly php framework is then it will be easy for you to choose framework for you.
http://iwebeffects.com/what-is-php-framework-how-it-works-and-which-one-you-should-use/
#28 by dumpster rental phoenix on May 2nd, 2013
| Quote
What’s up, all is going perfectly here and ofcourse every one is sharing information, that’s
actually good, keep up writing.
#29 by MobiHacK on May 20th, 2013
| Quote
Actually most of my friends started using frameworks. I also tried to use but didn’t find anything usable to me(I was creating an wap based autoindex). But after reading your your post i am gonna give a try again. Pray for me brother. Okay peace out