To Use a PHP Framework or Not?


I've started writing a few applications in PHP, and I'm becoming more familiar with the language. Someone told me about CakePHP, and CodeIgniter. I wanted to get a better understanding of how these could help me, and whether it's worthwhile spending the time to learn a framework?

10/12/2013 1:14:14 AM

Accepted Answer

What are the benefits of using MVC PHP frameworks ?

Well there are many benefits of using PHP frameworks, let’s see some of the main benefits of using them.

  1. These PHP frameworks follow some design pattern, so when you use a framework you have to follow their coding convention, which makes your code clean and extensible for future purposes.
  2. The Popular PHP frameworks like CakePHP, CodeIgniter, Zend Framework, Symfony follow Model View Controller (MVC) design pattern which separates business logic from user interface, also making the code cleaner and extensible.
  3. As everybody can guess, these frameworks contain a lot of libraries to make your job easier. For example: to validate a form you don't have to write as much code as you have to do in normal coding scenario (without using a framework), just a few lines of code calling the library is usually enough for it.
  4. While working on a large project in a team, an MVC PHP framework will be a great tool for development as you can assign a developer to develop one part of a module for a developer and integration will be quite easy of these developed modules at final level.
  5. These MVC frameworks really help you to develop the project rapidly, if you know a framework well then you'll never worry about the project deadline.
  6. Most of these MVC frameworks use clear url approach making your web project SEO friendly.

check article

10/7/2014 9:10:19 AM

My philosophy is that you should only use something when it solves a need that you currently have.

There's a real tendency, particularly in this realm, to simply use a framework for the sake of using one or because you feel like you should be using something. I discourage such practices. Also frameworks I think have the most value when you've done things the hard way so you have a good understanding of what problems you have and how the framework can help you in that situation. Framework choice does depend on the situation.

That all being said, the MVC pattern with Web applications is useful so it certainly wouldn't hurt you to learn at least one. I'd stick to a fairly minimalist framework however. CodeIgniter springs to mind here.

Lastly, the other danger with frameworks is that they can be so invasive that you're no longer doing PHP, you're doing CakePHP, Symfony or whatever. That's not necessarily a problem but the danger in it being so invasive is you don't get a good grounding in PHP and if you ever want to change it'll simply be too hard that you'll never be able to do it.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow