Which PHP5 Framework is Your Favorite?
matt_j_99 asks: "With all the talk about Ruby on Rails, I've been thinking about PHP frameworks. Ruby on Rails looks pretty cool, but frankly, I don't want to learn a new language. It seems that with all the slashdot discussion about RoR, somebody always makes the valid point that PHP is not a framework. But with PHP5's, Object Oriented features, a standard framework might emerge. Prado, Carthag, BlueShoes, and PHITE all seem like interesting frameworks. What PHP frameworks have you used in your applications? What were the pros and cons of each? Which framework do you think will have the best chance of long-term viability and maintenance?"
Sounds conspicuously similar to "I was coding in Prolog when I discovered BASIC."
For very simple pages, pages that amount to slightly more code than a server-side include, PHP is a perfect fit. This is obvious because PHP was originally made to be a page-embedded version of Perl -- originally written in Perl. Back in the days of CGI scripts, mostly in Perl, when you only had a little bit of code and a lot of markup, PHP (and ASP, ColdFusion, etc.) were a breath of fresh air.
However...
Embedding logic in your presentation layer is a bad idea. It ties your code to how your presenting it. Want to change how your site looks? Gotta change code. Want to change from HTML tables to CSS? Looks like it'll be a fundamental rewrite.
This is the problem that PHP -- and most mod_perl-based frameworks for that matter, like Slashdot -- have. It's a write-once language that you simply pile more and more code on until it breaks. Then you start over again.
We do not have the same preconceptions. We are coming from completely different points of view.
You: PHP is just as valid a programming environment -- if not more so -- as ASP, JSP, ColdFusion, and all the others for writing logic in web pages.
Me: Writing logic in your presentation layer (your web pages) is a bad idea no matter what language you use.
See the difference?
Of course you have. Usually the more you do something, the better you get at it. But I'm not suggesting that you drop PHP for something like JSP. I'm suggesting that they both suck as web development models. PHP is simply the newest kid on the block to support this crappy development model.
But ASP had CreateObject to instantiate any scriptable COM object registered with the system. ASP was meant to be a logic linking framework, not the logic itself. In other words, the code that did the heavy lifting was not supposed to be the Visual Basic Script; it was supposed to be your COM objects -- written in a more powerful language.
People are writing the "heavy lifting" code in PHP. This design pattern is known as "Big Ball of Mud." You may be getting better at giving it form, but it's still a ball of mud.
So in other words, you are doing today what you did ten years ago, only faster -- neither cleaner nor more secure.
Incidentally, speeds for process invocation and forking on many platforms has increased dramatically. Those old CGI scripts in C and C++ would run faster even on the same hardware, eg. running the same code on Linux 2.0.x versus 2.6.x.
- I don't need to go outside, my CRT tan'll do me just fine.