Code Igniter

Every once and a while you come across a blog post or forum discussion about what PHP application framework is the best. They each have their own positives and negatives, but the true answer to that question is that it depends on the programmer. Each programmer has a different style and different priorities when it comes to adopting a tool kit to use when building apps.

My framework of choice is CodeIgniter (CI) and below are my 10 reasons why CI rocks:

MVC Architecture

The model, view, controller architecture is nothing new. It seems like all the coding frameworks are MVC nowadays, and if they aren’t it can be configured easily. I have had experience building large apps the procedural way and every time they end up with unmanageable spaghetti code. The MVC way of doing things offers nice code separation and keeps things clean. Some frameworks force you to do things by the books but CI lets you use MVC in a way that makes sense you. If that means ignoring models all together then so be it.

Little to no server requirements.

Unlike other PHP frameworks, CI works with both PHP 4 and 5. That makes the lives of someone like me who has to be able to work seamlessly between the two environments much easier. Of course I have painted myself into a corner from time and used PHP5 techniques in my apps, but the framework itself works on either.

Easy to understand and extend.

CI is the first framework that I used that actually makes sense to me. I have tried Cake PHP, theZend framework, Symfony and many others and I was able to get up and running with CI the quickest. CI is also easy to write new libraries, change the behaviour of existing libraries and just change the overall behaviour of the framework with little effort.

All the tools you need in one little package.

Calendar, e-mail, zip encoding, validation, uploading, sessions, unit testing… that is just a few of the built in libraries that come with CI. It also includes a boat load of default helpers for things like forms, file handling, arrays, strings, cookies, directories and more. Plus, if that wasn’t enough, you can create your own libraries and helpers or use code that has been developed by the CI community and posted to the wiki.

No “installation” necessary.

Believe it or not, one of the hardest things I have experienced with trying new frameworks is installing them. I am not a fan of UNIX command line so I tend to look for tools that I can install and use by just uploading files to a directory. CI fits this requirement nicely. No need for PEAR packages or server modifications to get the framework up and running. Just upload the files to your server and your off.

Built in security tools.

CI allows you to implement as much or as little security as you feel is necessary for your app. It does some things by default like unsetting all global variables regardless of PHPs register_globals directive and turning off the magic_quotes_runtime directive during system initialization so that you don’t have to remove slashes when retrieving data from your database. Other things can be enabled like cookie encryption, handling session data with a database and automatically escaping SQL queries.

Database abstraction and more.

Every decent framework has a database abstraction layer nowadays and CI is no exception. You can easily create insert, update and delete statements without needing to write raw SQL. Handle connections to multiple databases within one application and connect to any of the following database types: MySQL (4.1+), MySQLi, MS SQL, Postgre, Oracle, SQLite, or ODBC. CI also lets you manipulate your database like add/remove columns from tables, create new tables and remove old ones using it’s new database forge library.

Large and active user community.

The last time I checked, there were over 57,000 registered members on the CI forums. That is a nice and big user community to work with when you have a problem or question. The CI website has a forum and wiki when your looking for answers. No confusing group mailing lists or chat channels just to get a quick answer to a question.

Excellent documentation.

By far, the biggest advantage of CI over any other framework is it’s documentation. I will admit to trying some other frameworks while they were still in BETA and under development. But, CIs documentation is 10 times better than other framework documentation I have come across and I strongly think thats because CI is backed by a company and not just a community. EllisLab, the company behind CI, takes a lot of pride in CI and they have big plans for it and thats why they don’t have a problem in spending the time that is necessary to come up with quality documentation for the user community.

Will soon be one in the same with Expression Engine.

The #1 reason why CI rocks are that Expressing Engine, Ellis Labs content management system, is currently being rebuilt to use the framework. This means that whatever libraries, helpers, etc. that you develop for CI you can use with EE in the future and vice versa. This also means that whatever EE needs to operate, CI gets. This could means things like an improved parser class, built in user authentication, ability to easily program modular applications and more. All of this is just speculation as the new version of EE is not out yet, but a man can dream.