Raw PHP vs PHP Frameworks has been a hot cake of a discussion between PHP developers for years with some developers preferring raw PHP and others frameworks. Although both raw PHP and frameworks have their own advantages and disadvantages, it mostly comes down to workflow preferences and demands of the project. If you belong to either side of the spectrum, check out the advantages and disadvantages of Raw PHP and frameworks to take an informed decision when picking either raw PHP or frameworks for the development.

 

Frameworks Advantages:

 

·      Framework introduces an extra layer to wrap your business code which in turn provides better manageability and easily workability in teams. If you take an example of any MVC framework; you can understand that the teams can separately work on Model, Views and controller part. ORM (Object-relational mapping) provides easy scalability.

·      A framework gives you some tools and function to make it easier for yourself. For example the database seeds, the form request classes, the migrations, and so on.

·      In framework everything come as set of predefined codes, helpers, libraries. So, you don’t have to write your own pagination, security code or integrate someone else’s pagination, security scripts. Framework follow specific standard which makes the codes more organized. Besides, frameworks have organized MVC pattern that separate your code into 3 categories, excluding the probability of code.

·      Framework is better because almost everything is provided, you need to write less code and there is less to worry about.

·      Frameworks usually have security classes in the core. Some methods of Input class have flags to clean XSS from _POST or other global array.

 

Disadvantages:

 

·      You need to learn more as there is a specific learning curve for specific frameworks.

·      Frameworks are slower than raw PHP code.

 

Raw PHP code Advantages:

 

·      Raw PHP offers you a lot of freedom a lot of space for imagination and invention.

·      If code is small; going with procedural PHP/PHP-RAW is good idea.

 

Disadvantages:

 

·      You need to write lots of code that may already be written.

·      There is more to consider about, like security (SQL Injection, XSS), organization of code, separation of business logic, view etc., (that frameworks already do it for you)