I’m fed up of using the same PHP template pattern over and over in my web apps, so I decided to write it from scratch and iterate on some core ideas. And then open source it under an Apache 2.0 license.

The result is Bonita: a simple PHP templating engine. It’s definitely version 0.1, but I thought I’d put it out there now in the spirit of release early, release often. Future enhancements will include a static cache, simple functions to handle action tokens for XSS, and some stubs to do things like semi-automatically generate RSS and Activity Streams.

Isn’t PHP already a template language? Yes and no. Its origins are definitely as a template language, but these days it’s a perfectly good way to write fully-fledged web applications. After all, Drupal, WordPress, StatusNet and Elgg are all PHP-based. (Yes, the language is much-maligned, and certainly has its flaws, but it’s also much-used.)

Aren’t there already templating systems for PHP? Yes, but they’re typically designed for sites rather than apps. Bonita includes support for creating streams and automatically drawing PHP objects out of the box, as well as content post-processing and template plugins. Support for anti-XSS form action tokens is another example of a feature that really mostly makes sense for web app developers.

Why are you releasing this? By releasing this under an Apache 2.0 license, I get to continue using the ideas, but I also get to share it, and let the wider community help me build out the system. That seems like a more efficient model for development to me; it also sits better with me. (And, hey, if nobody uses it, the worst that’s happened is that I have a great backup of my code on GitHub.)

Are you releasing Bonita on behalf of anyone? No. This is my own code, and it’s not being released or endorsed by any other organization or entity.