As you probably know, when it comes to code (both in and out of work) I’m a Ruby and Rails guy. It’s not necessary to go into much detail “why”: the expressiveness of Ruby and the dynamism and speed of development in Rails are big wins for me.

But it’s not always possible – or practical – to knock out Rails applications for every task, and right now, I need to deploy something in PHP. Something very simple, that doesn’t warrant the deployment overheads of Rails (which we’re all aware of, right?)

Refusing to get caught up in WordPress if at all possible (not going into that again, either), I set out to look for a nice, well-documented, lightweight PHP web framework.

Oh dear.

A few hours later, I’ve actually found something I’d be happy to use in anger, but the journey to get there was particularly harrowing. There are an awful lot of PHP frameworks, and they’re all of varying quality and documentation. They’re remarkably fragile beasts, for starters, and the state of documentation is enough to make anyone tear their hair out.

I initially looked at Symfony, which I’d heard good things about. And it’s pretty good: it’s powerful, well-documented, and nicely expressive. But it’s mired in lots of command-line helper scripts – far more so than Rails – due to the lack of introspection, and it’s also reliant on PHP5 – which isn’t a huge downside, except I’d have to install it, and I’m trying to avoid that right now. I could certainly see myself considering this if I was a full-time PHP developer; right now, the learning overhead is rather too large. But it’s worked for Yahoo, and it certainly looks very mature.

At the same time, it’s partly hampered by PHP itself. A major plus point for Rails is its interpretation of the ActiveRecord pattern, and the way it can perform object introspection. By contrast, in many PHP frameworks, you seem to spend a lot of time generating SQL at the commandline. Which is just boring.

And, in my case, unnecessary; I’m really not interested in making something very complicated. The site I’m working on is trivial. This turned out to be a really good starting point: working out what I didn’t need from a framework (or, at least, what I didn’t need as a default) was a good starting point.

I’m not sure it’s worth detailing all the wrong-turns I took, suffice to say there are a lot of half-hearted, atrociously-documented frameworks out there. What I came to in the end was a breath of fresh air: CodeIgniter.

CodeIgniter is a sideproject of EllisLab, best known for ExpressionEngine. The thing that really stood out for me was its polish. It works in PHP4, out of the box, because that’s a very common setup. It comes with excellent documentation in every install. It assumes, by default, that you don’t require a database – and if you do, you can configure that as minimally as you want. It won’t generate SQL for you, you’re in charge of that. It’s got a nice extension architecture. I’m really impressed. Of course, I’ve yet to use it in anger, but it seems nice and simple so far.

Still, it’s a shame that so many of the frameworks in the PHP world are so fiddly and intricate. CodeIgniter is a success for me because it plays to the strengths of the language it’s written in, and not necessarily to the specific demands of its creator.

1 comment on this entry.