Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Framework - what is a PHP framework? [duplicate]

Tags:

php

frameworks

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

like image 495
Charles Darke Avatar asked Mar 11 '09 15:03

Charles Darke


People also ask

What is a PHP framework?

A PHP framework is a platform to create PHP web applications. PHP frameworks provide code libraries for commonly used functions, cutting down on the amount of original code you need to write.

What is difference between PHP and framework?

Core PHP has a rich set of functionalities available so that the developer does not have to embed the same code again and again. When it comes to PHP framework, they usually have a fixed set of rules and hence the code can be passed from one developer to another without any hassles.

What is framework in PHP with example?

A PHP framework makes development faster. For example, you don't have to write complex queries to retrieve the data from the database. PHP frameworks provide CRUD operations (Create, Read, Update, and Delete). Frameworks enable developers to scale systems easily.


2 Answers

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 of using a framework 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 big 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.
like image 109
Treb Avatar answered Oct 12 '22 22:10

Treb


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.

like image 41
mozboz Avatar answered Oct 12 '22 22:10

mozboz