views:

339

answers:

5

What are the advantages/disadvantages of using a PHP framework over just writing direct PHP code?

A: 

As noted by Tomas and Ngu, the your question is duplicate.

What I'd recommend, that you first read what web framework is. http://en.wikipedia.org/wiki/Web_application_framework

vartec
A: 

A framework gives you standard solutions to typical problems, e.g. for an online shop that can cover the functionality for a customer login (including session handling), a shopping cart, placing orders...

The big advantage is that

  1. You don't need to reinvent the wheel, the code is already there
  2. The code (usually) works, it is already tested
  3. Specifically for user authentication, you will most probably have fewer security leaks as if you invented something from scratch yourself

The bis disadvantage is that

  1. If you want to extend the functionality, you have to understand OPC (other peoples code)
  2. If the framework contains a security hole and an exploit is available, your site is immediately vulnerable, but you may not have the knowledge to fix it yourself. So you need to keep a constant lookout on security bulletins, updates, fixes etc.
Treb
A: 

A framework is a library. You have an investment of time to learn how to use a library, but once you know how it works, you should get back your investment many times.

A PHP web framework applies this principle to all the common things you do when you produce a (usually database driven) website with PHP.