If you’ve heard about php frameworks like Laravel, Symfony, CodeIgniter etc, you may ask yourself why should I use these frameworks? When I can get request parameters, store data and handle my logic, why should I use frameworks?
Let me demonstrate the future problem with a story. Think of when you get your programming project, and you start to plan for this project. For example a simple accounting project. First you design a simple UI with HTML and CSS, and you continue with defining user flows and use cases for this application (naturally our solution for this accounting application is web application). At this step you know about application processes, for example you know you have a login page, you have a page to define employees and something like that. So, now you have everything to start coding with pure php. You know php syntax and you do coding very well, and all is done. You make it very well.
The problem arises
By now everything is fine! And application is ready to use. After 6 months you decide to add new feature, or your employer tells you new business needs (we know that every feature comes from a business need, and the most important thing is that the business needs are endless. Agile).
So, now you should come back and do some refactoring (changing existing code to meet current needs) or in best situation you must add some code. But you find out that you do not remember why you created some classes, their role and how they really work! (think about this situation for more complex applications and software). So you are in trouble..! What is the solution for this situation? You start to define some structure for your coding, may be even more commenting, and defining some conventions (for example you group classes with directories). And if you do it very well that means you are creating your own framework 🙂
The main reason to use a framework is to escape from an unstructured code (known as spaghetti code which you cant find any rule within it). Also it has many other benefits, for example when people follow a common standard, they can help each other, and code for other systems and applications (mostly developers have indirect cooperation through packages). It worth to mention that this is not only for pure php, the scenario is the same for other languages.