Lithium PHP Framework

Last night I attended a presentation on the “Lithium Framework” by Garret Woodworth (@gwoo on Twitter) at the OCPHP Meetup.

Lithium is promoted as a fast and lightweight PHP framework. Garret’s presentation started out with kind of a history of PHP and some of the new features in PHP 5.3 — which they’re trying to put to good use inside Lithium. So features like Late Static Binding, Namespaces, Anonymous Functions and closures are all being put to very good use within Lithium.

The Library namespace of Lithium comes with a host of additional classes that would be advantageous to many developers. There are the usual utility function to help with form validations, and implement a templating system, but there are also tools like Collections and Iterators — which are used in many places within the core code. There are also Socket and HTTP classes and even an example program that implements an IRC bot.

Another powerful feature of Lithium is their implementation of Filters, following the Aspect Oriented Programming model. This allows you to add a filter to an existing action being performed by the framework, modifying behavior on the fly. This is done without having to extend an existing class and override methods — something that would be impossible if not for the fact that they’re using PHP 5.3.

Lithium is not quite ready for production use at this time, unfortunately. They’re currently on version 0.7, with a projected 1.0 version some time in May, 2010. Even though it’s not quite finished, there is a suite of unit test code that is provided. Their goal is to have 85% or more test coverage on anything that is shipped. This promises to provide a pretty stable release.

Garrett and many of the other developers of Lithium have also worked in the past on the CakePHP framework. Lithium has split from that code base in order to develop a framework that takes advantages of the latest features of the PHP language.

And if you’re interested, slides from the presentation are available.

I’m going to be keeping an eye on this one since I like the idea of a framework that uses some of the latest features of the PHP language, rather than sticking to older versions of PHP like CakePHP does.

Leave a Comment

Your email address will not be published. Required fields are marked *