• As usual with things like this: a decent client library that's at least somewhat up-to-date (official or no) goes a long way to helping you decide which [x] provider to use. In this case: SMS gateways that send to the UK.
  • "This is all very preliminary, but here is a first pass as a Processing Kinect library." Ooh.
  • Trap streets – yes, of course. But trap rooms; trap architectures? That's iiinteresting.
  • "Bookland is a fictitious country created in the 1980s in order to reserve a Unique Country Code (UCC) prefix for EAN identifiers of published books, regardless of country of origin, so that the EAN space can catalog books by ISBN rather than maintaining a redundant parallel numbering system." Awesome. Via Kim (who else?)
  • "This tutorial assumes no previous knowledge of scripting or programming, but progresses rapidly toward an intermediate/advanced level of instruction . . . all the while sneaking in little nuggets of UNIX® wisdom and lore. It serves as a textbook, a manual for self-study, and a reference and source of knowledge on shell scripting techniques. The exercises and heavily-commented examples invite active reader participation, under the premise that the only way to really learn scripting is to write scripts." Really good stuff, which Nick pointed me at this morning when I revealed I couldn't write bash scripts.
  • "If / when telly people complain that their industry was blind-sided by the internet/interactivity I think it might be fair to point out that this was made in 1990. And that it was shown – ON THE TELLY. Or would that be mean?" Douglas Adams' documentary "Hyperland", a crash course in hypertext written and shown pre-the-web.
  • "The best games communicate their systems to us in ways that feel satisfying, and the quality of this dialogue between player and game often determines the success or failure of the game." Michael Abbott's been playing Demon's Souls.
  • "Raphaël is a small JavaScript library that should simplify your work with vector graphics on the web. If you want to create your own specific chart or image crop and rotate widget, for example, you can achieve it simply and easily with this library." Looks really rather interesting, and potentially beautiful.

An ExceptionNotifier for CodeIgniter

25 June 2009

CodeIgniter really is turning out to be The Little PHP Framework That Could. I’ve now dived pretty deep into it and still have few complaints; as I’ve said before, it makes all the boring stuff easy, has almost no “magic”, and stays out of the way.

As the application moves towards production, though, I began to miss a few things from Rails – notably, its ExceptionNotifier plugin. ExceptionNotifier will send you an email every time there’s an error on the site, which is really very useful with production applications.

So I investigated alternatives for CodeIgniter. I stumbled across this Stack Overflow post, which basically outlines exactly what I was looking for.

Except it doesn’t work.

Never mind! We can fix that, and the end result is MY_Exceptions.php:

(You might want to “view raw” on that – there’s some funky syntax-highlighting going on).

This really does work out-of-the-box with CodeIgniter 1.7.x. You just drop it into system/application/library, call it MY_Exceptions.php, and it’ll extend the existing Exceptions library. Obviously, you’re going to need to change a lot of the obvious details like email addresses you want things sent to, and the name of the production domain you’ve configured in your app’s config.php. You also need to make sure the error log level is set to “1” or higher in that config.php file. But that’s about it; it really does work, and means that in production alone, you’ll get email from your app when a PHP error gets thrown, along with not only the line number and file the error was thrown in, but the URL that the user was accessing to generate the problem.

Not bad for an hour’s work. And, because it’s a Gist, you can either copy and paste, or just clone it straight into your application.