What I’m thinking about PHP frameworks?
They all suck!
Why they all suck?
Everyone need a framework, but everyone doesn’t need a general-purpose framework. Nobody has a general problem, everyone has a very specific problem they’re trying to solve and the general purpose framework while can solve it, it usually solves in a way that you get so many other things that you don’t need that ends up being done on every request. There are frameworks that check to see which database you’re using so you have a request.
– Hey which database we’re using
– OK let’s load the MySQL class, that loads up this thing and loads of this thing that initializes the arm and tells it to use this database.
2 miliseconds later the next request comes in.
– Hey which database we’re using
– Still mysql
And every request we’re asking all this questions there, always hooks and all this things dynamic decisions that need to be made on every single request that does not changed from one request to the next.
Usually what happens. One a big company when they grows and they started with a general-purpose framework, they start optimizing things by ripping stuff out, just tear the framework apart to the point where they could never upgrade. So if there’s a new version of the framework it doesn’t really matter because they’ve modified the damn framework so much that they’re stuck on the version they’re on and I think that’s a huge problem.
So I would wish that the framework guys would have some way of doing a production push where you fit configure “Look I’m using the auth module, I’m using MySQL always and I’m using this particular thing in this particular thing and nothing else” and then the framework should have some kind of “push this” and only push the components that you need to the production servers. So none of these other run-time decisions ever get made.
But the dev environment and the production environment shouldn’t be the same thing in this case because it’s a scripting language, there’s a lot of things that happened at run-time that shouldn’t be happening at run-time. I see a lot of people taking general-purpose framework and stripping it down. The other thing I see are people starting with no framework and then adding pieces of modular frameworks. Just pulling out one piece of a framework and using that and pulling out another piece of another framework maybe and using that. But there are many frameworks we pull one piece out and the whole things goes right down, but there are some frameworks that OK, that are modular enough that you can pull things up. Many frameworks are so interconnected that it just doesn’t work.
Usually, I tell people to look for a targeted framework. So, if you have a problem that looks a lot like a blogging problem. Maybe, WordPress should be your framework… Right, it’s not a great framework but if it’s something if your problem is very close to something WordPress can handle, chances are you’ll be using most of WordPress. There won’t be all these other general-purpose things you won’t touch. And that way you have a better targeted framework. And you’ll be able to upgrade as WordPress upgrades. Or you might be using something like Drupal. So if it’s a more content management that fits more in the Drupal side of the house then maybe Drupal is a better framework for you, because it is more targeted than a general-purpose framework.
Rasmus Lerdorf: Creator of PHP