Why I moved on from PHP

Alex Hudson has written a good piece on Zend Framework 2, and why he’s moving on from Zend Framework. I was an active contributor to Zend Framework from 2006 until 2008, and I moved on also.  In fact, I mostly moved on from PHP altogether, in large part directly because of Zend Framework.

I’d like to say it was because of the Java influence which is on its face largely at odds with the language it’s built on—but really, it was because I was tired of PHP and its ecosystem. I was tired of the weak typing (not dynamic typing), inconsistent function names, anything-goes argument orders, the generally poor quality of libraries and open source projects, the community values that led to both, the resulting difficulty in hiring good developers from that community… well, I could go on.

There were counterpoints to most of these arguments, and I made them to others. But eventually the weight of the problems added up, and I wanted options. Zend Framework seemed to be trying to turn PHP into Java, and although I hadn’t yet made a value judgment about Java I knew that wasn’t appropriate for PHP. It’s essentially a glue language like Perl, and the “PHP way” (such as it exists) is about lightweight, quickly-bootstrapped solutions. Otherwise, what is PHP good for?

At best, most developers see PHP as a hammer—not particularly fast or elegant, but it gets the job done.

Zend Framework highlighted these problems for me.  It served as a stark contrast to the quality of other PHP components, but exemplified the schizophrenic direction of PHP as a whole since 5.0 (PHP’s SPL—its Standard PHP Library—is every bit as Java-like as Zend Framework).

I glanced at Symfony and some other projects, but what I really wanted was something that addressed my complaints: strongly-typed, consistent, good libraries and community, etc. Professionally I began writing Java, both with and without frameworks like Spring and GWT. At home I began writing a lot of Ruby, using the MacRuby project to supplement some Cocoa I had already learned using Objective-C. I also played with Rails 2 and Merb.

The Java started off well enough—I was creating the same types of complex multi-tier applications that I did under PHP, but this time backed by static typing and a huge library of components from Spring and Apache. But even after I was up to speed, development was slower. I had always heard how Java was heavy, but now I truly experienced it: Spring, a “lightweight” alternative to Struts, had so much explicit (and, to my mind, pointless) infrastructure setup that I was thoroughly disillusioned with it within six months.

I had already blogged about why I thought writing JavaScript by proxy was a bad idea, but I was questioning all my assumptions and so I decided to explore GWT as well. In the end, my experience was similar to Spring—it was all too slow. In the case of GWT I felt both too far removed from the end result and occasionally too near (when I needed to jump into writing native JavaScript using JSNI). This leaky abstraction was explained as a fundamental design decision, but never sat quite right with me. I knew it was necessary, and that was the problem.

At the same time, I experienced none of these problems with Ruby. During this time of exploration I wrote a variety of things: a parser library for a non-trivial binary file format, some GUI components using MacRuby, a website in Rails 2, and an API in Sinatra. I started looking into Merb, but learned it was merging with Rails and so started becoming familiar with Rails 3 instead.

Contrary to my experience in both PHP and Java, I loved every moment writing Ruby. Like Python, it is both strongly- and dynamically-typed. I found the libraries to be generally high-quality, and when they weren’t, the authors tended to be up-front about that fact. The community, inspired by the Rails philosophy, was constantly pushing the envelope by embracing the latest and greatest, almost to a fault. It had a good community that valued pragmatic solutions.

It’s four years later now and I still love Ruby. It’s not the best solution for everything, so I’ve continued to learn new languages (my latest being Python), but it’s generally my first choice.

I still occasionally write some PHP at work. There’s a lot of sighing involved. Zend Framework has some good components and when appropriate I recommend it as a library. I wish it were more modular.

I wouldn’t recommend the MVC—it’s slow, and it places things in the way of routing that should probably go elsewhere. Zend Framework architect Matthew Weier O’Phinney is a smart guy, but he’s trying to drag the PHP community almost single-handedly toward the PHP-as-Java point of view. Frankly, I don’t think it’s right for the community and I don’t think the community is that interested. I predict Zend Framework 2.0 adoption will be glacial. Most people probably won’t ever bother making the switch.

Like this post? You might also like Coalmine, my centralized error tracking service for your apps. Coalmine captures errors and all kinds of helpful debugging information, notifies you, and makes it all searchable. Check it out!

23 comments

  1. Hi – Great blog post – feeling a little similar myself. Another issue with PHP is that trying to get a PHP job is now complicated because many recruiters are now insisting on years of experience with one of the several popular frameworks as well. Within a reasonable distance of where I live it all seems to be Zend Framework whereas I’ve used CakePHP in the past. When I’ve dabbled with ZF it seems to be overly complicated in comparison (e.g. form decorators). I was hoping v2 would improve this but it looks like it is going to get worse. Will be interesting to see if the local agencies stick with ZF and end up uncompetitive as a result.

  2. Thanks for the blog post, it’s an interesting read.

    I’m in a similar boat to Richard in that a lot of contract roles (in London anyway) over the last 6 months have been asking for ZF/Symfony2 experience. This kind of forces me to at least look at other frameworks as I’m from a Codeigniter background (which has been great, which is why I’ve stuck with it), to see if they have such great features that it’s time for a switch.

    I can see why ZF has become so popular, good marketing and backing as well as certifications…and I hear Symfony2 has a strong community and some nice new features as well…I guess local agencies pick a framework to use internally, stick with it and that dictates the market’s need when it comes to recruitment.

    I’ve had a look at ZF2 and the skeleton app and the structure looks ok so far but if the documentation is like the current version it will be awful to try and learn.

    Symfony 2 has had a lot of positives said about it so I think i’ll be looking into this until the official ZF2 release

  3. Hi Matthew,

    It is some point of view you present here. I didn’t even realize you were no longer a ZF developer, after so many contributions you made.

    It is remarkable that the concrete complaints you have about ZF 1 (not modular enough, form decorators too complex) are addressed in ZF 2. It is modular by concept and decorators have gone. The performance issues have also been taken away mostly.

    I have played with ZF 2 for a while now, but having very little time to experiment with it it is too early for me to predict its future. What I do see is that it adds a lot of flexibility and it takes time to learn how to handle all of that.

    About PHP becoming like java: I understand what people are saying, but the problem with me is that I never really disliked java once I properly understood how it worked. I could get things done with php more quickly though and it is true that using Zend Framework slowed down development at the beginning. However, now that I am used to building applications based on Zend Framework, it is not that slow and it is very well testable.

    Overall, I am still determined to give ZF 2 a try.

    • You have given some hope to PHP developers. But java thing. I also do not like that. I do not want PHP a Java.

    • Thanks for the reply, Bart. Perhaps it was taken as a backhanded compliment, but I do think ZF has some of the best components in the PHP community. This really should have been two posts, but I guess my point was that I’ve observed that there seems to be an impedance mismatch between the PHP community and Zend Framework. I will be very interested in the adoption rate of ZF2 given some of the changes that have been made.

      As for me, I’ve also started doing projects in Node.js and CoffeeScript and I’m having a blast.

    • Hy Ashley,It is not working. I am usinn maetngo 1.4.1.1 and your extension 1.4.3.I send you the test message, so eventually you can help me out fix it.RegardsASchroder.com SMTP Pro Self-test resultsTesting outbound connectivity to Server:Using Google Apps/Gmail configuration optionsFailed to connect to SMTP server. Reason: Connection refused(111)This extension requires an outbound SMTP connection on port: 587Sending test email to your contact form address :Unable to send test email. Exception message was: Connection refused Please check and double check your username and password.Contact Form test email did not use SMTPPro to send.Testing failed, please review the reported problems and if you need further help visit ASchroder.com to contact me.

  4. I just tried to get through the tutorial for ZF2. I love ZF1 and all its quirks. I know it’s slow, but we all use APC… right?

    ZF2 is disgusting. Why not just make ZF1 better? Introduce PHP namespaces, improve performance, and maybe make everything a bit more modular.

  5. I tried to give my contribution to ZF1 but it was terrible to work with it in all aspects.

    The situation with ZF2 is different and I’m satisfied with its organization and new or changed features. Many obstacles that existed in the previous version are fixed in Zend Framework 2 so I’m going to give it a chance.

  6. I have had a similar evolution over the last 10 years of web development. Perl->Java->PHP->RoR, but still working a lot in PHP. Most recently looked at trying to use ZF2 or SF2 input validation as a stand-alone library in a non-ZF2/SF2 framework application. Not easy. Just stumbled on the Aura project, which is attempting to make each module work independently. Worth a look, but as you say the true visionaries seem not to be in the PHP world anymore.

  7. I really like what you guys are usually up too. This type of clever work and exposure!
    Keep up the superb works guys I’ve incorporated you guys to my blogroll.

  8. Thanks for some other informative site.
    The place else may I am getting that type of informaqtion written in such an ideal means?
    I have a challenge that I’m simply now operating on, and I have been on the glance out for
    such information.

  9. The Carl Zeiss VR One headset is another VR headset that utilises the expertise in your smartphone to
    offer you a virtual experience.

Leave your reply to roznoszenie ulotek