P-H-P (dee-dah-dee) M-V-C…

Apologies for referring to the Jackson 5 in the title (if you didn’t know what it was, which would be perfectly excusable). But I wanted to mention a new PHP Framework I’ve found, called Code Igniter.

I’ve been casually developing a sort of gallery system recently — in a similar vein to Matthew’s — and … well, it was getting messy. The problem with PHP is it’s flexibility: it allows you do some some really cool stuff … but it does allow your code to become a total mess. Granted, you can have a total mess in any language, but with PHP it’s just so easy!

You really need to use some sort of MVC pattern to make sure that your code is organised and tidy. You can do this yourself, or you can use a framework. I prefer using a framework, as it means a lot of the work is already done for you (although, of course, for smaller projects you don’t always need it – hence me not using it for this gallery initially…)

This is where Code Igniter comes in. In a similar fashion to Ruby on Rails, it divides your application into nice sections. You have a directory called “controllers”, another called “views”, and another called “models”. You just put the relevant bits of the application into those different directories, and bingo! You have an MVC application. It’s also got some really cool features to do with loading properties and libraries, and a whole bunch of other helper libraries.

If you do PHP development and are looking for a lightweight framework, I would suggest giving it a look 🙂


Comments

Leave a Reply

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

Related posts

Get new posts by email