PHP, Zend Framework and Other Crazy Stuff
Archive for January, 2008
PHPSpec 0.2.0beta Released
Jan 7th
It’s been a longer than expected road to 0.2.0, but I’ve finally gotten around to releasing the first beta of PHPSpec 0.2.0.
PHPSpec is a Behaviour-Driven Development framework designed from the ground up to offer a BDD tool for PHP5. It’s functionality and use is heavily influenced by similar frameworks in Java, Smalltalk, .NET and Ruby. This beta release marks the start of a short review process with the aim of making a general public stable release within the next 7 days.
PHPSpec is currently hosted on the PHPSpec PEAR channel at: pear.phpspec.org. Installation is as simple as:
pear channel-discover pear.phpspec.org pear install phpspec/PHPSpec-beta
Additional installation options (for those who don’t like PEAR) and instructions are available in the PHPSpec Manual which is currently hosted at http://dev.phpspec.org/manual. I made the effort to keep the manual as informative as possible so it should be relatively easy to get started with PHPSpec, and discovered what Behaviour-Driven Development (BDD) means if you haven’t caught one of my earlier explanatory blog articles on the topic.
This beta omits several items which didn’t make the scheduled cut off point of Sunday evening which I’ll complete for the GA release. The main ones are a PCRE regular expression matcher, improved Equality matcher, and something to predicate expected Exceptions. Besides these three missing bits, the goals originally set for 0.2.0 have been met and in some cases exceeded as time allowed.
PHPSpec has been one of those projects I found a real need for in my own development work so most of the design and functional decisions have tended towards a personal preference. Just a reminded that as a 0.2.0 release the API will remain stable for the life for the 0.x point releases but remains open to improvement based on user feedback and suggestions. We’re also currently investigating adding a HTML UI and optionally running specs in their own unique PHP process. In addition, PHPSpec has led to two other small libraries in progress – namely PHPMock and PHPMutagen. It’s been an interesting open source project to say the least, and I hope it’s well received by the community.
Any questions/comments may be directed to the PHPSpec Mailing List (and Google Group) over on:
http://groups.google.com/group/phpspec-dev.
ext/snarl: PHP interface to the Windows Snarl Notification Tool API
Jan 7th
It’s far from rocket science, but this small extension I wrote over the Holidays allows PHP to send messages to the Snarl Notification Tool. Snarl was inspired by Growl for Mac OS and despite it’s reliance on a C/C++ API (versus a network API as with Growl) isn’t too hard to work with.
My intention for the API is to facilitate Window’s use of a soon to be announced tool for autotesting in PHP using PHPSpec. The basic idea is that rather then switching to a console to rerun selected tests or specs for each change a developer makes, a behind the scenes PHP process automatically detects modifications to files and reruns only selected tests/specs relevant for those files, and reports results in a notification popup. The difference between this and the usual method is really simple – by avoiding switching to the console and/or running all specs including those unrelated to the change (which feasibly can take anything from a few seconds to a few minutes), you can shave time off your development process. In a nutshell, in many cases it’s just more efficient and stays out of your way.
I hope to propose a completed version of the extension to PECL shortly. For the moment I’ve only implemented a single method to display a timed notification of some event. Obviously the extension itself is not specific to PHPSpec use – anywhere PHP would be useful in creating a desktop notification on Windows.
The source code is currently in subversion at http://code.google.com/p/php-snarl/ on Google Code.
I haven’t uploaded a compiled .dll extension yet but I’ll get around to it soon. Usage will be relatively simple. The extension defines a PHP5 class called (predictably) Snarl:
[geshi lang=php]
$snarl = new Snarl;
$snarl->showMessage(‘Title’, ‘Notice! Your PC is about to explode!’, 5, ‘C:/icons/warning.png’);
[/geshi]There’s other parts to the Snarl API but showing timed notice messages is the most common use case. It’s likely PHPSpec will in the future bundle similar dependencies for Mac OS Growl and KDE Notify (possibly depending on its API for KDE4) as part of a small abstraction library to make use across platforms easier.
Happy New Year!
Jan 1st
It’s that time of the year again (the first day) when the idea of 2008 still seems shiny new and exciting to behold on your calendar. Go on, admit it, seeing 2008 gives you an anticipatory thrill.
It’s now about two years since I shed the pseudonym Maugrim and I now have a 3 in 5 chance that any particular website won’t die when I enter a-acute characters for my real name into a web form. Now that’s real progress! Let’s get it up to 4 in 5 this year!
Looking back it’s been a fairly good year. I became far more involved in open source projects including my own meagre offerings. I’ve seen the rise of the Zend Framework and it’s gradual evolution into a praise worthy framework – even its adoption of some of my own proposals. I finished my qualifications as a Chartered Accountant here in Ireland. I bit the bullet and kickstarted three projects to hopefully push and prod some improved TDD/BDD practices (PHPSpec, PHPMock and PHPMutagen). I became the Irish Representative on the OpenID Europe Foundation and did a ton of work to be finished soon on writing a PHP5 library for OpenID and the Yadis Protocol. As usual I typed too much on the Devnetwork Forums
– looking for another Devnet Award!. I even refreshed my C knowledge which I’ve barely used since 2000 and started writing a small wrapper for the Windows Snarl API. Oh, and I learned Ruby which was quite an experience and I even managed to avoid Rails as a largely pointless exercise. Ruby without Rails is quite cool enough. I also had a few articles published on Zend’s Devzone.
My outlook for 2008 is bright. There’s a few projects in open source which will become stable and enter their maintenance mode (see above). I’ll be working with the Zend Framework more on large projects, including a reentry to PHP game development. I have high hopes of attending a few conferences during the year since I should have a less hectic year. Maybe one day I’ll even give in and create a Facebook account
.
The coolest stuff for PHP has no doubt been already covered. PHP 5.3 is incoming with namespaces which will be welcome. PHP6 continues progressing which I’m really looking forward to since I absolutely hate all the UCS4 gynastics I currently indulge in for parsing characters. Zend Framework should hit another major release version. Things seem on track on a much improved testing/specing landscape in PHP – PHPUnit 4 with PHPMock & Hamcrest, SimpleTest for PHP5, and my own and Travis’ PHPSpec for Behaviour-Driven Development. I’m sure Ruby users will also realise why a Windows Snarl API is applicable here too
. And PHPT for PEAR2 is also coming along very nicely under Travis Swicegood. I’m also looking forward to seeing how Adobe AIR influences web apps this year. After using Spaz (a pretty good poster child for AIR) by Ed Finkler there’s a lot of potential there for desktop integration to web application APIs.
Here’s to 2008!
