David Turner

Picking a Framework

I'll be honest folks, I don't know where in the hell the last few weeks have gone. So many different projects to juggle, both in and out of IMD, keeping them all organised seems to be taking up so much time that it doesn't leave any time for actually doing anything.

Today that's changing. Today I'm going to be, briefly, covering my decision with regards to some of the more technical aspects of my Major Project, in particular looking at which PHP framework I'm going to be using.

Examining the Options

Coming from the foundation degree (and thus jumping from second to final year) I was advised, several times to get an idea sorted in my head as to what I wanted to do this year for my Major Project. As a result of this, and of my obsessive nature, I not only came up with a myriad of ideas, but I also started conducting experiments that related to what I would want to cover.

One of the areas I knew I wanted to look into was using a PHP framework as the basis of the project. I can use already existing solutions for projects, and I've coded my own solutions from scratch to solve problems. This year I want to take a look at using a starting point to create something as this will be a useful skill to have once I've completed this year and am unleashed on the world in a more official capacity.

There are a lot of PHP frameworks out there and, over the summer, I took some time to experiment with several of them. Most of them either confused or annoyed me but one or two stood out as pretty cool. The advantage of using a framework is that, regardless of which I develop with, the skills I learn using one PHP framework will largely transfer to any others I use. The complete list of frameworks I looked into would be:

  • CakePHP
  • Lithium
  • CodeIgniter
  • Yii
  • Zend

One the whole all of the frameworks, except for CodeIgniter, confused the hell out of me. I think this is part ignorance on my part, as I knew nothing about using/understanding frameworks, and partly that I used CodeIgniter first, based on a recommendation by Andrew Ellison.

A couple of weeks ago, however, Rumblelabs, the people behind Onotate gave a fantastic talk about how they built their webapp... and all the things that they did that people shouldn't do. It was a pretty unique look at how to go about developing a webapp as, instead of going over the process of how people should do something, they were sharing information on what they had done wrong. They also made me decide to look at one of the other frameworks I'd experimented with, as opposed to going with CodeIgniter. Their project, eventually, was built up using the Yii Framework.

'Bout Yii (blatantly stolen heading from the Rumblelabs Talk)

Yii is, to be blunt, fast it was designed with the following questions in mind:

  1. Is it fast?
  2. Is it secure?
  3. Is it professional?
  4. Is it right for my next project?

The answer, and what their name is an abbreviation of, is "Yes It Is". Yii confused me at first because of the way their tutorials start, with a rather vast amount of command line prompts which I have limited to no experience with. Since my first experiences with Yii I've had a bit more experience with making magic happen with the command line. As such I've found things a bit easier to work with than in the past.

There's one other advantage of Yii, which I'm hoping to make use of later in my project, it's ability to serve up files quickly (especially when caching is turned on).

Comparison of PHP Framework speeds
In this image, longer lines are better. CodeIgniter and Yii are top dogs, with Yii soaring ahead once caching is enabled.

Is it right for my next project?

Yes it is. After having taken some time to sit down and get Yii actually working there aren't many differences between it and CodeIgniter in terms of how it works. As I've mentioned above learning how to use a framework is largely framework-agnostic, so the skills I've learnt using CodeIgniter should transfer pretty easily to Yii.