The Idea Basket

Winning the PHP 5 Framework Wars

Permanent Link  |   book mark Winning the PHP 5 Framework Wars in del.icio.us Del.icio.us  |   See this page in technorati Cosmos  |   submit Winning the PHP 5 Framework Wars to digg.com Digg  |   submit Winning the PHP 5 Framework Wars to slashdot.com Slashdot

The race is on to take a bite out of the Web development platform pie and become the dominant PHP 5 framework. Who are the players? What are the stakes? Who will win? This essay will spell it all out for you in black and white.

What is this “framework” of which you speak?

In order to carry on a meaningful discussion, we need to establish some known parameters so we can understand exactly what we’re talking about. PHP is a language designed primarily for building Web sites and applications. It is a rich language with a huge core library of functions that allow you to do just about anything. And that’s the downside. Seriously, the very nature of PHP’s function count has caused many a heated argument in the blogosphere, since some programmers prefer to keep things small and modularized (probably in a fully object-oriented manner). The upside to PHP is that it has a very small learning curve. You can literally get up to speed building simple sites in minutes, even with no programming experience.

So what does this have to do with frameworks? Well, the reality of Web development is that 80% of what you do on every project is reinventing the wheel. You take all the tiny little bits of functionality provided by the PHP language and you cobble them together to make something useful. For some people, including myself, you tend to build up your own library of classes and tools to help you with every new project. This only goes so far however, since what you end up with is a half-completed mishmash of a framework that evolved without any real design forethought. Obviously, unless you really enjoy tinkering with lots of code libraries nobody but yourself will ever use, it makes sense to build your 20% of custom application on top of somebody else’s 80% of abstracted PHP guts.

OK, that sounds good: just go grab a framework and off you go! Sure, no problem — until you discover that there are many, many frameworks for PHP available. Some are quite good, others are…not so good. How do you determine which one to use? More importantly, which one is going to “win” and gain the most market share? After all, you don’t exactly want to use something that’s going nowhere fast.

The added complication of the PHP framework space is that there is a gigantic rift coming right down the middle of the PHP community, and that is the difference between PHP 4 and PHP 5. Anyone starting brand-new development of a project in PHP 4 is doing the equivalent of writing software for Windows 98, so there’s really only one reason to use a PHP 4 framework and that is for sheer hosting compatibility. But if you have a good host that supports PHP 5, then all is fine and dandy in PHP 5 framework land, right?

Reality check

Wrong. The latest stats for PHP market share are in from Nexen.net, and (assuming they’re reasonably accurate) this does not bode well for PHP 5. After nearly two years since PHP 5.0 was released (back in July of 2004), the PHP 5.x series commands a whopping…7.2% of the PHP market. That means that PHP 4.x is still at 92.8% marketshare! Furthermore, according to the Nexen.net survey, only 34.5% of PHP 5 servers are running PHP 5.1.x which contains crucial new features and is a far more solid platform than any of the 5.0.x builds.

Whoa. Clearly there is something disturbing about these numbers, and here is why. If you offer a PHP 5-only framework (let’s be generous and say it’s 5.0.x compatible) that manages to snag 10% usage share of the entire PHP 5 market — which would be quite impressive — you’ve captured only 0.72% of the PHP market. Folks, this isn’t enough momentum to sustain a platform, innovate, and compete. PHP may be a far more popular language than Ruby, for instance, but I think it’s safe to say that Rails has virtually 100% of the Ruby community’s attention (Ruby on Rails, in case you’ve been living under a rock the past year, is one of the hottest Web frameworks on the planet right now). If your framework has 0.72% of the PHP community’s attention — well, you get my drift.

So what am I driving at? Simply this: the winner of the PHP 5 framework wars will be…no one! At least, not in the Darwinian sense of the word. We truly need to refocus on what the real objectives are here, and it’s obvious building a better mousetrap over and over again isn’t getting the PHP community very far.

Objectives for the future of PHP

  1. Adoption of PHP 5.1+ needs to increase dramatically over the next year in order to make it a viable language for long-term platform growth. I believe this can happen as more “killer apps” come out for PHP 5 and hence force hosting companies to support something better more modern than PHP 4.3.x and MySQL 3.2.x. Part of the problem here is that PHP is a victim of its own success. So many people use PHP for simple scripts and pre-installed apps like phpBB that the incentive to get on the cutting-edge PHP 5 bandwagon just isn’t there yet. That will change when these pre-installed apps start working on PHP 5 only because the developers can’t stand PHP 4’s limitations any longer.
  2. A “culture of objects” and a push for standardized design patterns need to be fostered. Zend should be taking a proactive role here, and so far they haven’t done much. PEAR could fill the gap, but it’s limited by stymied community involvement and far too much legacy baggage. I’m no fan of Java, but one thing the Java community is good at is providing packages that can be mixed and matched based on a common OOP infrastructure. Most J2EE development uses many different packages from different vendors (and often a lot of community-based Apache stuff). In essence, you don’t go “find one framework” and develop with it, but instead you determine your requirements and then find the tools that can get the job done. Now of course you can mix and match classes from different sources in PHP as well, but few of them follow any kind of commonly-accepted design patterns. Might this change with third-party additions to the Zend Framework? Who knows, but I certainly hope ZF doesn’t become yet another PHP walled garden.
  3. Platform-oriented PHP projects need to start communicating with both competing and complementary third-parties. Listen to me, O developers of frameworks, Ajax libraries, ORM data tools, CMSes, what have you: if you’re in it for more than just short-term fame or money, and I hope you are, then you need to reach out to the rest of the PHP community. We desperately need to improve interoperability, focus on secure, robust code, and encourage marketing of PHP 5 (and not 4) solutions that encompass projects from many different sources. The goal here isn’t solely to make your project succeed, but it’s also to make PHP 5 succeed, because if it doesn’t, your walled garden is going to slowly disintegrate as other technologies pass it by. Yes, PHP is doing very well now overall, but so was Microsoft a couple of years ago. Don’t get fat and lazy on PHP 4’s good fortune.

For the last point there, I personally hope I can do something. As project lead for xajax and the new Willowgarden application platform, I have a responsibility and a duty to reach out to other sectors of the PHP community and make sure they are able to put my tools to good use. And visa-versa. So far, I’m sorry to say, I have not taken the time to do this effectively. Believe me, after thinking about everything I’ve written here, I will. And I encourage you as a PHP developer, whether you’re a newbie or an expert, to do likewise.

As we look toward the future of PHP 5, PHP 6, and beyond, I hope we can be realistic as well as optimistic. The success of PHP already has been formidable, and as long as we take action now to make waves in the community, its future success is certain.

Remember: a rising tide floats all boats.

19 Responses to “Winning the PHP 5 Framework Wars”

  1. Jeff Moore Says:

    7% in two years is disappointing. I think Andi said somewhere that 50% of Zend’s customers are on 5. I think the adoption numbers really highlight two different camps in PHP: dedicated hosting vs. shared hosting. Professional development versus amateur development. (I don’t mean amateur in any negative sense) For me, as a professional developer, PHP 5 is a killer app. However, it seems that for the amateur shared hosting crowd, PHP 4 is “good enough.” So, my question is what is the killer app that can get end users to demand php 5 hosting?

  2. Nate K Says:

    Great article (even though I was looking for some thoughts on the frameworks out there…hehe).

    I have tested several in the past few months (as a part of my job to test different technologies). I have tested symfony, Zend, Cake, and CodeIgniter. My biggest complaint lies mostly with the robustness of each. I know that sounds odd, but I like building sites with simplicity - giving them just what they need without extra baggage. Now, I also build my own frameworks for any given project - so that makes it easier.

    The database support is mediocre at best for the majority of those frameworks. If you have a normalized database structure then you are going to have to do some more work and dive deeper into the core of the API.

    So, I see so many frameworks out there - but each time I see them I just see a BIG picture of many things I don’t need or use (in any given project). I believe you have to know your niche with your site, and not OVERDO it with things that arent necessary (just because they are in the framework library).

    Im keeping my eyes open….

    Peace,
    Nate

  3. Jared White Says:

    Jeff, you’re defintely right about the shared hosting crowd. It’s what helped make PHP so popular, but now it’s holding PHP 5 growth back. Like any platform, you need killer apps for traction. Apple started creating a number of killer apps for Mac OS X not long after it was first released, which helped convince people to jump ship from Mac OS 9. We need more PHP 5 killer apps, so hopefully some of the existing big names can bite the bullet and leave PHP 4 behind.

    Nate, you have some good points there. I think a lot of PHP developers are used to “rolling their own” and keeping things lean and mean, so a lot of frameworks are way overkill for them. However, it’s difficult to design a good system that’s loosely-coupled to a large extent and can be divided into little pieces. I think Zend is doing an admirable job on this — you may want to give them a second chance. :)

  4. Sam Stevens Says:

    Great post, Jared! I certainly find myself often caught between two PHP rocks, rock 4 and rock 5. Hosting is a big part of that. One thing I’ve been wondering that might help push PHPers forward is: when will Zend include PHP 5 in their certification program?

  5. Michael Crowl Says:

    One thing I’ve run into, for instance at GoDaddy, is the default installation of Redhat Fedora Core 2. Default install, MySQL 3.23, PHP 4.x.

    I wonder how widespread that hands-off install is - not many developers want to deal with RPM installations when going live, so they’ll settle. It’s quite possible that it’s not that “PHP 4″ is “just good enough”, but that upgrading disturbs the quick install process hosting companies rely on.

  6. Jared White Says:

    Well, Michael, since Fedora Core 5 is out by now, I would say an old version of PHP is the least of GoDaddy’s problems. :)

  7. Michael Crowl Says:

    Well, true, Jared. But I’m wondering if this is really limited to GoDaddy. I build sites for a variety of small businesses, and they always want the cheapest hosting solution (a problem unto itself) - and I still bump into the PHP 4.x / MySQL 3.23 combo MUCH of the time.

    I just wonder if we’re actually being limited to PHP 4.x by the distros the hosting companies are using in 2006 - because they think they are “stable”, or just out of laziness.

  8. Norman Gerre Says:

    Breaking backwards compatibility certainly slowed adoption. The widely-used scripts which broke have pretty much all been fixed by now, but the damage was done. It’s not just that servers are stuck at PHP4, more than half aren’t even running the 4.4 branch.

    Another issue is that, while the new features are utterly fantastic, they do require change. Well, duh — but if change is required, why stop with PHP5? Why not jump to Ruby or Python? If you have to discard your “legacy baggage” anyway, switching languages isn’t a great leap. Rails and Django both have better press than anything PHP’s got.

    Speaking of frameworks in particular, there’s incentive to wait, too. For my money, I’m hesitant to start using anything else while the Zend Framework lurks on the horizon. I’m not going to risk a developer preview in production, but I don’t want to commit to a largish project in (e.g.) Cake if ZF is going to be the clear winner a few months down the track.

  9. Emil Ivanov Says:

    Very good post.
    I’m a amateur PHP developer and I wanted to share what are my experiances.
    I think the first problem is that learning a new framework is very timeconsuming. And the problem is that every framework has a strong and weak spots. I think this idea is very good: Simple, small piece of code to deal with something small, but do it really good. The only problem will become when things need to be put all together…
    The very first problem, for me, is that PHP lacks uniform conventions. Everyone writes the code as he wants. Freedom is a good thing, but with every choise comes responsibility. It will be good if some document state that you should start your class names with an uppercase, etc.
    Also because of this much freedom everyone says: “Hmm, I want to build an app, but this framework (some1 else’s code) - I don’t like. I’ll start from the ground and build everything up.”. And as you sad - we end up with a bunch of files/classes that have no logical structure, or even nonsense.
    Please, don’t kill me for sharing my minds with you. :)

  10. Lennert Stock Says:

    It’s not that shared hosting providers are lazy or that PHP 4 is good enough. From a hosting provider’s point of view, there are two issues at hand: 1) The PHP 4 branch has proven to be stable, and more importantly, 2) PHP 5 can potentially break PHP 4 code. I think what PHP should have done is create a much better update strategy. For example, it could have distributed a PHP4+5 by default, giving providers the options to run them both (.php and .php5 or whatever) out of the box. Didn’t the same happen with perl a few years back?

  11. Jared White Says:

    The PHP 4+5 shared hosting situation can be complicated, to be sure, so that’s an issue. On the other hand, the hosting company I use (Site5) was already doing PHP 4.x as CGI rather than as mod_php (don’t ask me how that works, but it’s very fast and usable) since they considered that more secure. So when they added PHP 5, they made it work on .php5 files only by default, and you can override that so PHP 5 works with .php files via an .htaccess file. Pretty nifty.

  12. carl mcdade Says:

    I have no stats to bach this up but I would say from my last two years in looking at shared webhosts that them running PHP4 is not their fault. The fault lies in the hands of the control panel manufactureres who can seem to get PHP4 and PHP5 to work together and give stability. This is the same thing that is slowing MySQL 5 adoption, it is what is chocking ASP.NET. Both Classic ASP and PHP4 have shown that unless you make it easy to host with a good control panel and easy server administration, it ain’t going no where.

    The killer app that will launch PHP5 into 98%? A shared hosting back end that works with PHP5 out of the box.

  13. Vinit Joshi Says:

    My view is the PHP needs massive clean up of all the 500+ functions it currently has by using OOrientation and make PHP a fully object oriented language. There also needs to be a VM framework a la .net for all major platforms and so developers can develop not only for the WEB but smart clients, rich clients etc. For that a mature thread framework needs to be established along with an event modeling subsystem - PHP-GTK but more cross platform.

    In short make it more general programming language, even though this seems to be taboo in this community, PHP is a web languange and that’s it, well.. that’s why PHP 4 is sticking around… its a web language that’s good enough why bother with anything else if the emphasis in the community is that PHP is a web language.

    Got to make is general if you want more developers to come, web is just one part, there are many server-side services that need to run etc. to do many other things as well

    Vinit Joshi

  14. Alderete Says:

    A “culture of objects” and a push for standardized design patterns need to be fostered. […] I’m no fan of Java, but one thing the Java community is good at is providing packages that can be mixed and matched based on a common OOP infrastructure.

    I think that you need to distinguish between “design patterns,” which are an implementation detail, and standardized APIs. What the Java community does very well is create, discuss, refine, publish and then implement to a wide variety of standard APIs. This is what gives the Java developer the flexibilty to choose which toolkit to use for a given project, based on requirements, and have it work with other libraries created by other developers or produced by commercial entities.

    The fact that these standardized APIs may utilize or even advocate particular design patterns is not what makes them relatively interchangeable. The interfaces, as defined by the method calls and arguments, is what matters.

  15. Jared White Says:

    Well, perhaps my semantics aren’t exactly right, but basically you’re absolutely correct Alderete, and that’s what I was trying to convey.

  16. Matthieu Rethers Says:

    Here are my thoughts on the various comments:

    1. About the slow adoption of PHP5

    I think PHP4 is good enough if you are not looking forward to build robust applications. Most of the people using PHP4 and shared hosting don’t usually work on critical, large scaled projects. When you start doing serious stuff, like entreprise portals, you will most likely need privileged access to the server to optimize your application or integrate third-party, non-php components. Most of the good PHP4 frameworks out there had to emulate basic object functionalities like abstract classes, encapsulation, type hinting. So yes, PHP4 can probably do what you need, but not as well as PHP5 and most likely by tweaking your design. So I definitely think that serious architect wil lnaturally turn to the latest version. Considering also that no version of PHP is considered stable (according to a guy from the bug fix team), you are strongly encouraged to switch to more recent versions.
    Some features are not obviously necessary, like PDO (although some kind of unified drivers are becoming necessary: ADODB, PEAR::DB, Creoel, what else ?), but the adoption of the exception mechanism and the OO were a must in my opinion and are the number one conditions for the creation of a good framework.

    2. The war is actually the problem

    As it’s been said in some of the comments, the strength of the java community is to stick together and all go in the same direction. Have you ever tried to contribute to a PHP project ? Well I have, and I must say that most of the time, my help has been rejected, I think because these projects owner don’t want to share their glory or think they know better. Fine then, I’ll start my own project, and someone else is going to create another one, and so on. It makes the PHP community look stupid. It’s not seen as “Oh there are so much stuff, I get to choose whatever I want” but more as “Damn, there is way too much stuff, I wonder why, they all got to have a problem…”. Take the ORM projects. I think there are about 6 or more of them, they all do the same thing, kind of, so why not grouping them ? “Oh no, my project is much better, I don’t trust you, you are going to still my thunder”. You see my point.

    3. What a good framework would be

    As previously mentionned in one of the comment, the main problem is overdoing stuff. If you integrate too much in your framework, you are pretty much killing it yourself. Next time I want to switch to a different database manager or a different form validator, I have to change of framework. Developers out there, FOCUS! What made the success of Java ? Loosely coupled components that are smartly built to integrate with other components and work together hamoniously.
    So what do we really need ?
    * A good MVC framework, that’s for sure. With years of experience building web application, I know there are patterns that are pre-dominant (dispatching, etc) and widely accepted in other languages. Most important aspects for me are a strong session management, a strong ACL and a flexible architecture with as many extension point as possible to integrate third party tools. Lightweight please, take advantage of the flexibility of PHP, we are lucky not to have the heavy strcture of J2EE containers.
    * A good ORM framework, why not. This can save some time.
    * A DEVELOPEMENT PLATEFORM LIKE A .NET STUDIO OR WEBSPHERE. That’s the main point to be considered by the industry as a productive technology.

  17. Steve Says:

    check out PHP on Trax its by far the best PHP 5 framework i’ve seen out there.

    http://www.phpontrax.com

  18. Ma_rio Says:

    Facts seem to show how PHP5 is an alternative to Java more than an alternative to PHP4.

    Javization of PHP is likely a strategic trade-off (raw popularity for “enterprise” acceptance).

  19. PHP Says:

    “If your framework has 0.72% of the PHP community’s attention”… then that’s tens times the number of Ruby developers. PHP is popular, Ruby is not.