Meet Phergie

At one point not too long ago, I told Ben Ramsey about an idea I had to write a PECL extension that wrapped the libircclient library in an OO API. Serving as a good catalyst to get me working on the project, he registered it as a SourceForge project and got a good foundation checked into SVN. I’ve managed to make a few small contributions here and there to the code base and ideas for the userland API. Still having limited knowledge of C and the PHP engine, I thought my efforts might be better put toward a project that could use the extension once it was released.

So I decided to try my hand at writing an IRC bot in PHP. Most tutorials I’d found on the subject barely covered the tip of the iceberg, only showing what anyone with a copy of the PHP manual and the IRC RFC could figure out in the time it took to read the tutorial. Additionally, I could only find two existing packages that were relatively well-developed and outside of an alpha state.

The first was PEAR::Net_SmartIRC. It is PHP 4-based (not good considering the upcoming PHP 4 EOL), hasn’t seen active development in three years, and I don’t particularly care for the priority system it uses to order event handler execution. The second was PHP-IRC. It is PHP 5-based, has an OO API, and is more full-featured. However, it doesn’t appear to have seen active development in two years, has no online documentation viewable via a browser, and has a rather paltry plugin selection.

I had toyed with some previous iterations of Phergie, some Python-based and later some PHP-based, before I finally got an API design I was happy with. At the suggestion of a fellow IRC mate on Freenode, I registered the project on Assembla so that it now has a Trac site as well as an SVN repository. It’s been through a few releases already and, though there are still plenty of open tickets for improvements and additions, it’s becoming a fairly well-rounded package. When the PECL extension is released, I will be able to write a driver for Phergie to wrap it and provide an alternative driver to the single streams-based driver that is currently available.

I’m considering writing an article on my experiences, one that I could potentially pitch to several sources for publishing, either online or in print. It’s more of a recreational topic than a professional one obviously, given the nature of the usage that IRC sees these days, but I still think it’s an interesting topic nonetheless and can actually encompass more “enterprise-level” solutions than one might realize. So, stay tuned.

Update: I completely forgot to throw a shout out to Jordi Boggiano (Seldaek to those of you on Freenode). Without him, most of the plugins that the project now sports would never have been written. I also neglected to mention that we have an IRC channel on Freenode, #phergie. Feel free to join in on project-related discussions there. Chalk a few up to me being silly enough to trying posting while being sick as a dog.

3 Comments

  1. Ben Ramsey says:

    I guess this means I have to finish that extension now, huh? :-)

    One of these days I’ll find the time to do a good sprint and complete it.

  2. Hi Matthew,

    It sounds like an interesting project. I for one would certainly be interested in reading more.

  3. Mazzu says:

    I just want to add few words about PHP-IRC.
    The development is no longer active for 2 years but the community is still active on the support channel and the development is quite complete.
    So, PHP-IRC is still active and it works well. I’ve done a hack to read the log it create : http://irc.mazzu.com/logs/?jour=2007-02-26. And the log is certainly not the best feature, there are more interesting features with PHP-IRC.