PHP is not a framework
This post started as a comment on Kay’s blog post about Akash Mehta’s post titled “Last we checked, PHP IS a framework”. But my comment veered off-topic. So here we are. Feel free to recurse back and read what they had to say on the subject.
I would not call PHP a framework. I tend to think of it as a language that has a useful set of built in functions that are geared for the web. Some of these functions have poorly chosen names and inconsistently ordered parameters, but that’s another rant for another day.
I think of these functions as a standard library. Frameworks tend to encourage specific patterns. PHP and its built in functions do not have an opinion on patterns. Thus, I make the distinction between a library and a framework. Even PEAR is considered to be a library by most people. So it is a stretch trying to call PHP a framework.
PHP is popular because it has a low barrier to entry. It is easy to get started with, it’s free, it runs on many platforms, and is readily available through most hosting companies. This means that it attracts a lot hobbyists and dabblers. I’ve seen my share of horrible, horrible PHP code. But nothing in the language prevents you from writing good, maintainable code.
Ultimately, the big guys like Yahoo! probably picked not just PHP, but the LAMP stack as a whole. It is a proven, fast, scalable stack. Importantly, it is also one that does not have a major stakeholder like Microsoft (.Net), Adobe (ColdFusion, Flash) or Sun (Java). With the recent talk of Microsoft acquiring Yahoo!, can you imagine the leverage that Microsoft might have had if Yahoo! had built its business on top of Microsoft technology?
When assessing PHP, it is often the sum that is the LAMP stack that wins out. Not the PHP part by itself.