Core PHP or PHP Framework, Which one to choose for web development?

In this article, I will explain, why should we prefer PHP Frameworks over Core PHP for our projects. A website built from scratch using a PHP framework is easier to maintain and control on a long term. More specifically, a framework might do a particular task more quickly than code you wrote yourself would.

The comparison between Core PHP and PHP Framework can be related to Mathematics.

  • To solve a complicated problem in scientific mathematics, you can either take a paper to work out, or you can use a scientific calculator to solve it.
  • Working out mathematics in a paper is like coding in Core PHP, tapping a scientific calculator is like coding in Framework.

Popular Frameworks like CakePHP (I wouldn’t recommend for large projects), Symfony, YII, Zend has a lot of resources put into making them as efficient and capable as possible.

Pros:

  • Ready to Use.
  • Provides functionality you might not know how to write yourself or ‘basics’ that most projects need take a long time to write.
  • You will get community support to improve your code or fix bugs.
  • Modification Projects: If the client come up with new innovative requirements, if the project was done with core php, then you will have to say no for 70% of his requirements. But, if you have used framework, very easily you can give the updated project back to the client.

Cons:

  • Learning curve: You need to know all the functions, classes, and methods provided by the framework. Good frameworks are complex, and learning how to use them can become a full-time job (some much more than others – many coders will “lock” themselves into a particular framework because of this – i.e., start thinking of PHP in terms of “Zend” or “Cake” only). Also writing Core PHP inside Framework has become common nowadays, it’s an insult to Frameworks.
  • Overkill: for most projects taken on by a single developer, especially a beginner, frameworks might be significantly more work than is actually needed for the task.

Finally I would like to suggest developers(especially for beginners and intermediate developers) and clients to prefer frameworks for their web applications. While picking up a new php framework make sure that, it has good documentation, community support and meets up your requirement.