How PHP Frameworks Can Go Bad
Hey guys. My name is Roberto and I have been a web developer for the past five years. I will be blogging about interesting things in the life of a developer
I have worked with a few different frameworks over the course of my development career (e.g. CodeIgniter, Laravel, Symfony) and have also tried/tested many others. I always felt that frameworks are these perfect libraries of code that will make my life easy, and generally, that has been the case.
But over the last few months, I realized that frameworks are not perfect. Not even close. And although they do make annoying things like form validation or URI routing super easy, it seems that the simplest things can become buggy or complex.
No framework is perfect
Case and point: I have been working on a pretty decent sized project using CodeIgniter (my 4th project using this framework). CodeIgniter seems to be everyones “first”. The first framework where beginner PHP developers learn important skills like OOP and MVC.
But as I said, things are not perfect.
I kept getting some weird behaviour with PHP sessions, specifically when logging in and out in IE (insert IE insult here). It took me a few hours to solve the issue, mainly by partly rewriting some third party session library. But I felt it was really weird that something as simple as PHP sessions was broken (I mean there aren’t even that many PHP sessions functions)
So whats the point…
I basically have two main points:
- Frameworks are not perfect libraries of code that will make developing a breeze. They definitely do help (without a doubt), but dont be surprised to find bugs that will take you more than a few hours to fix.
- Saying that, fixing these bugs actually helps you become a better developer. It gets you to get into the smaller details and overall you learn much more about developing in PHP
When developing somewhat complicated web apps, I think using a framework is almost a must. Choosing a framework on the other hand…thats for another day.
For more discussion, you can find me on twitter here