10 Reasons Why CodeIgniter Rocks
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:
| 10. | 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. |
| 9. | 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. |
| 8. | Easy to understand and extend.
CI is the first framework that I used that actually makes sense to me. I have tried Cake PHP, the Zend 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. |
| 7. | 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. |
| 6. | 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. |
| 5. | 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. |
| 4. | 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. |
| 3. | 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. |
| 2. | 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. |
| 1. | Will soon be one in the same with ExpressionEngine.
The #1 reason why CI rocks is that ExpressiongEngine, EllisLabs 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. |





I have to say, I really appreciate the way you framed this post. IMO, all the this framework vs. that framework blog posts are kinda missing the point of having multiple frameworks in the first place. I’m also happy that ZF shares at least some of the attributes you like about CI.
On point 8, you should check out the new Zend_Tool component that we’ll be releasing in the laboratory soon.
My #1 reason why Code Igniter rocks? You can use it so easily in combination with ZF!
I too love CodeIgniter. I tried really hard to like the Zend Framework as it’s supposed to be extremely simple and is viewed as the “official” php framework. Despite my best efforts, I found ZF to be extremely difficult to set up. In particular, I remember routing to be a pain. I was able to get everything done that I needed to get done, but it was far more trouble that I was hoping it would be. So I started looking at CodeIgniter. Since then, I’ve rewritten my main web applications that I maintain using CodeIgniter. I haven’t yet looked into Expression Engine in detail but if CI and EE merge then that would be really nice.
I have also done a lot of Ruby on Rails development. I set up my RoR server before Phusion Passenger (mod_rails) was released so I’ve got mongrel clusters running all over the place. So point #6 is extremely nice as CI doesn’t require any crazy installation. Thanks for the post it was great!
Hey Lee, thanks for the comment!
Yeah, I tried hard to like the Zend framework as well for the same reason but I could never get it installed properly. I just can’t put my support behind a programming framework that has a lot of server requirements and such because then your program is no longer easily portable.
I’ve lost count of the number of apps I’ve had to move from one server/hosting environment to another and have run into so many issues because the server didn’t have what was needed to run the app (like PEAR extensions). I don’t have those problems with CI; as long as it’s running at least PHP 4 or 5 I’m usually good.
Numbers 8 and 2 sold it to me. I’ve played about with quite a few frameworks, but I fell in love with CI the first time I started using it. It is so, so simple, and the documentation so clear, that I reckon almost anyone with basic PHP + database experience would be able to get to grips with it. It just plain makes sense.
Good coverage and same feelings on many points. I am looking for a tool to help me construct my web apps as fast as I can think of them. I started years ago as a hobby with hand coding every character then tried Joomla and had hosting issues then wordpress and it is not as easy to create a CMS as I wanted …then I skipped around various PHP Frameworks hoping ZF would be the default quick and easy and powerful answer only to find that it is indeed CodeIgniter that Rocks in the easy and powerful department.
I am still learning but I have been able to solve a couple early issues and have great hope for the future ….
Good article. I just started learning CI. And believe me I love its style. Its really easy to do things with this for me. I have ZF. But it sucks while installation. And more than this article encouraged me to learn. Good to know that am on right track. thanks. and sorry for my bad English…
It is hard not to enjoy anything that compliments
Code Igniter! Yes, hands down the best framework I’ve ever used. Nice and simple, use only what you need type of environment.
It was a great way to learn MVC and PHP all in one shot!
I have just started to use it and was up and running within minutes.
What a contrast from the Zend Framework. ZF was a pain to install and was so difficult to understand. Even the tutorials on the official site didn’t even work leading me to endless frustration.
CI has cured all this. 10/10
I’ve spent about an hour trying to get Zend Framework installed on my Mac with MAMP. I’m a developer and have all kinds of apps running along with MAMP for all my testing. Installing Zend Framework is horrid. You have to modify the php.ini include_path then use a command line utility to setup a project…. then setup a bootstrap file and an index file.. and so on. I finally ditched it all together. This is suppose to be rapid development. spending this long installing the framework made me decide against it completely.
I remember previously I installed CI (CodeIgnitor) in about 5 minutes and was up and running…. time to go back to put some time into learning the syntax of CI.
ZF seems like a waste and doesn’t make you want to learn it if they can’t make the setup/install process more simplfied compared to many other popular competing frameworks
Ohh I forgot to add the worst part yet… ZF doesn’t even give you the proper files to setup projects?! 1.9… lol
/zf.sh create project quickstart
Warning: require_once(Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php): failed to open stream: No such file or directory in /Users/scottamort/Projects/zf-1.9/library/Zend/Tool/Framework/Loader/IncludePathLoader.php on line 31
Fatal error: require_once(): Failed opening required ‘Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php’ (include_path=’/Users/scottamort/Projects/zf-1.9/library:.:’) in /Users/scottamort/Projects/zf-1.9/library/Zend/Tool/Framework/Loader/IncludePathLoader.php on line 31
U52:bin scottamort$ ls ../library/Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php
ls: ../library/Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php: No such file or directory
U52:bin scottamort$ pwd
/Users/scottamort/Projects/zf-1.9/bin
U52:bin scottamort$ cd ..
U52:zf-1.9 scottamort$ cd library/
U52:library scottamort$ ls Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php
ls: Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php: No such file or directory
lol
Steve, I hear ya! Every once and a while I convince myself to take another look at ZF just because it’s supposed to be the enterprise framework for PHP and such. But it doesn’t take me long before I’m arguing with myself because I can accomplish the same things in CI much faster and simpler. Perhaps I’ve just never had a project big or complex enough to warrant ZF, I don’t know. I guess I will revisit again if I ever outgrow CodeIgniter (which I don’t believe will be anytime soon).
Nice list.
There is also a German-Speaking community at http://codeigniter.ch
CodeIgniting is fun
I am having second thoughts on codeigniter.The simplicity of it attracted me but its getting way too simple.Apart from datamapper and a couple of other contributions,codeigniter community lags behind cakephp and symphony maybe by a century.
Pingback: Getting Started with CodeIgniter and How to Create All Those Great Apps | DevSnippets
Pingback: Getting Started with CodeIgniter and How to Create All Those Great Apps « Web Development News
Pingback: 7 Secure, Lightweight, and Easy to Use PHP Frameworks | DevSnippets
Pingback: 7 Secure, Lightweight, and Easy to Use PHP Frameworks « qeqnes | Designing. jQuery, Ajax, PHP, MySQL and Templates
Pingback: CodeIgniter – Open source PHP web application framework | GuiDesigner
Wow, such a good post! Thats why I wanted develop an application that based on CodeIgniter framework. Right now I’m doing a “small review” on some avaialable php frameswork and maybe soon I might use CodeIgniter. Thank you for rock post!
Pingback: CodeIgniter : miniguida e risorse per questo ottimo Framework PHP | Pecciola
Pingback: Getting Started with CodeIgniter and How to Create All Those Great Apps | PHP Lovers
Agree to all the points…I’ve tried so many attempts to get into the RoR realm but finally had to duke out because of the installation and the deployment overheads. It’s not as smooth as copy/pasting the code and be done with it. CI Rocks!
CodeIgniter ‘s license is still the major issue for us. Until they decide to implement a proper open source license, that enables real freedom of use, we see no point in using it, however useful it might be.
It (CI’s weird license) especially gets complicated when combined with other frameworks or libraries.
I just don’t get it, what’s with the weird license anyhow? Has always been there, still there. Too bad.
There are much better frameworks around.
Codeigniter sucks. It might be easy to learn and quick to setup but do any common tasks and you can run into problems.
Firstly everything is loaded into the singleton class ($this->) which means my IDE can’t autocomplete any of the libraries I include in my project. Kohana forked CI and did it right with object instances for everything.
The folder structure makes code hard to share. Other frameworks have a folder for each module. With Codeigniter everything is stuffed into models or views or controllers. Because everything is spread out this makes it hard to use git submodules or subversion externals to include modules into your project. You end up with file soup.
Form generation sucks. Other frameworks have these things called classes. You create field objects, possibly extentions of core field classes and then rendering them out. Even with the 3rd party form library the form code is very messy and procedural.
tl;dr Newbies like Codeigniter because it’s over simplified. From a structural point of view it sucks.
My workplace will soon be moving to django.
Ben, you’ve misunderstood the purpose of CodeIgniter. It’s just an extension of PHP and is designed to make things easier which gives developers a peace of mind knowing they can build the most efficient application which saves resources.
And one of PHP’s creator endorses it, so if you’re really sure that it sucks, I think you must be one of those advanced coders.
And statistically, CodeIgniter is the fastest framework with it’s capability. I’ve been building PHP applications from scratch for nearly 8 years, and CodeIgniter is the best thing I’ve ever come across.
If I could donate to them, I’d give them a lot. Let’s just say that.
i also hit the Zend Framework wall. i had used CodeIngiter in the past but thought I’d try learning ZF. i found the learning curve for ZF to just be toooooo steep. i got acclimated to CI pretty quickly but there simply no end to the ZF headaches. The ZF documentation is unbelievably bad. ZF has some useful components but the documentation and the difficulty runs counter why people use frameworks. ZF makes things more complicated. CI just works
re: the CI license … what IS the deal with the license? i was thinking of using CI for a project at a local college that will be public facing. can’t have legal issues
The CI license is pretty open. All you really need to do is include a copy of the license with your code, etc.
http://codeigniter.com/user_guide/license.html
Ben, if CI’s singleton usage is overcomplicating CI’s oversimplified nature, I’m afraid you just contradicted yourself horribly. Seriously, there aren’t many classes to deal with to where it’s really a problem.
Second, if your worried about code soup, you should check out some of the Modular MVC extensions that people have put out there for CI 2.0. Also, they’ve tidied the whole thing up into an application folder for portability–you can use an infinite number of applications on the same core with a simple .htaccess rewrite and about a minute of your time.
I would like to stress that CI’s strength is really in its ability to save time by extending PHP without trying to rewrite it. You can write your models, views, and controllers, and tie them together with a minimum of effort and have 100% control over the process. The polar opposite IMO would be Rails, where 99% of the guides tell you not to wonder about the “magic” in the background, just to trust it. I want to know what my application is doing so I know how to fix it if something is wrong, sooooooo….. fuck that.
I agree with Ben, and I feel the people who responded to him failed to understand his argument. Kohana is much better than CodeIgnitor. It does everything that CI does, but it does it better. It’s easier to use with git, easier to use with an IDE, beautiful clear code, and it uses all the powerful additions than come with PHP 5. PHP 4 is dead.
The CI documentation is generally excellent. I’ve been using CI for just a couple of weeks, my first ever PHP framework, and although that the very beginning it seemed daunting, i was able to start coding quickly. It’s easy to install and use, and I’ve also found there are a lot of really useful plugins etc – tank_auth, for example, for user authentication. From a couple of benchmarks I’ve read (on the DooPHP site, for example), CI is also pretty fast.
Simon
Code Ignitor rocks, we have adopted it as a company framework and have been developing our own functionality ontop of it.
Looking forward to our long relationship with this awesome framework.
I’m sorry but I’d rather use no framework than CI. The price you pay for its light weight is that it does almost nothing for you. I moved to Yii and I’ll never look back – I’d much rather have a framework that is database-aware and generates all my CRUD classes for me. CodeIgniter is a good first framework to learn MVC on, but I don’t know any senior-level developers who would use it unless they had to.
I have to disagree with andy, I love codeIgniter and I’m a senior-level developer.
no framework is perfect for every project, each one has their own needs and requirements, but to say you rather use none than go CI is showing how inexperienced you are.
the great thing about CI is, its so small,I don’t need 40 MB worth of libraries that I’ll never use, CI gives you what you need and you can build around it.
I also like CI for the fact that they don’t jump on bandwagons, they try to keep things working. Kohana was a favorite of mine until they broke everything and documentation was left behind, I think it had potential, and still can if they improve the documentation and community effort.
I also think its wise to learn more than one framework, I know/used ZF, CI, Kohana, symfony, and they all work for what their designed for. don’t use the same hammer because it worked for 3 of the 4 things you were building, sometimes a smaller hammer will do just fine than using the ol’ sledgehammer every time.
PHP has dozens of them, so keep an open mind; I mean if you want a closed mind, use .NET where you can use .NET or .NET (which yes I’ve used this as well)
CI is brilliant in the fact that it is light-weight, flexible, easily extendable, simple to set up (5 minutes) and super fast.
i realy like CI from my point of view i like coding and in same time i do want things to be done fast
i built up my former site using plain php but when i get CI -he makes the life much easier
i hate CMS because they block everything behind -i couldn’t get control but with CI i can code fast
and get controll and save time
thus CI rocks
CI is the greatest.
great…!
I am agreed point by point…!