Posts tagged ‘Phergie’

Where I’ve Been

Things have been rather busy in my life recently, even though this blog doesn’t really reflect that. I thought I’d take a short post to share with any readers who may have wondered where I’ve been the past month or so.

I changed jobs a few weeks ago and the new one has kept me fairly busy learning processes, writing proposals, and beginning to work on projects. I’m getting acclimated to actively using Zend Framework again, which I’m enjoying.

I also recently launched Phergie 2.0, which was very well-received. Moving the project over to GitHub, launching the new project web site, and helping with the first round of bug fixes has kept me busy.

The ball has started rolling on getting my book published again. The ISBN has been obtained, the last round of edits is happening now, and the digital edition should be available for sale before the TEK-X conference in May. I’m hoping to have a few dead tree copies to distribute at the conference.

Speaking of which, I’ll be speaking at TEK-X, so I’ve also been working on preparing my presentation on new SPL features in PHP 5.3. I’m planning on putting my presentation content into (fairly long and embellished) blog post form, so keep an eye out for that.

I’ve been under the weather with a cold over the past week. I’ll try to find more time to blog once I’ve recovered and things have settled down a bit.

Environmental Awareness Quickie

I ran into an instance recently where someone was trying to run Phergie in an environment where the exec function was disabled. This causes a warning in the Quit plugin, which uses exec to automatically detect the full path to the PHP CLI binary on non-Windows systems that it will later use that path to initiate a new PHP CLI process to “restart” the bot.

I realized when I started digging into this issue that I wasn’t aware of a way to check the PHP configuration to see whether or not a function was disabled, save for using the ini_get function to get the value of the disable_functions setting and parse it manually.

Thanks to Johannes Schlüter for cluing me into the fact that the SPL ReflectionFunction class has an isDisabled method, which is exactly what I was looking for. Unfortunately, there’s no equivalent method in the SPL ReflectionClass class for the disable_classes setting. Thankfully, though, I haven’t run into a use case for that yet.

Update: Apparently I inspired Johannes to write a patch to add ReflectionClass::isDisabled(). It most likely won’t make it in until 5.3.1, but at least the patch is there if you need the feature. Thanks Johannes!

Phergie on C7Y Yet Again

The guys at C7Y really seem to like Phergie. The articles about the Phergie project on C7Y got a brief shout-out in the P3 Podcast for 4/17/08. Thanks for the plug guys! The rest of the podcast was really awesome too. I definitely recommend checking it out.

Phergie on C7Y Again

Part two of the two-part article I wrote for C7Y on experiences gleaned from developing the PHP 5 IRC bot Phergie has been posted. Feel free to leave comments in the article’s forum.

Phergie on C7Y

I’ve written a two-part article for C7Y on experiences gleaned from developing the PHP 5 IRC bot Phergie. You can check out the C7Y web site for part one and expect part two to appear there next week. Feel free to leave comments in the article’s forum.

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.