• Code Igniter

    May 14 2006

    I'm absolutely in love. While I bored was at JAX, I searched around for a PHP framework like Ruby on Rails. I already knew about CakePHP, but I wasn't convinced. I looked at a few others, but nothing caught my eye. Then I discovered Code Igniter.

    Code Igniter comes from the people who make Expression Engine. I had already heard great things about that, and I had even considered purchasing a license. Code Igniter, however, is free and open source. It's quite new (first beta was released in February) but it is incredibly professional and already very stable.

    Code Igniter does absolutely everything I want it to, and nothing I don't want it to. It's incredibly simple and clean, so there are no surprises or weird tricks. It forces you to organize your code using an MVC structure (actually, a VC structure — using a model is optional). This keeps your code cleaner and easier to maintain. It also comes with a number of libraries that help with common web development things like email and uploaded files.

    This weekend, I rewrote my whole custom-made blog code for this site. It only took about 4 or 5 hours, and it was actually fun to do. It also reduced the amount of code I had, and makes it much, much easier to maintain and change in the future. For example, until now I was too lazy to add contact pages properly, so I just added blog articles for Contact Me, etc. and pointed links at these. Now, I've changed the pages to use /contact/me and /contact/hire, and I could easily reuse my blog template. This change took about 10 minutes.

    By default, URLs are of the form /class/function/parameters. But if you want to do something different (I use /blog/2006/5/article-name), you can set up routing rules for anything you want. Actually, Code Igniter is totally flexible to let you do whatever you want. Anytime I got stuck, I poked around in the documentation and found that there was something in place specifically for my problem.

    Also wonderful: only the minimal amount of PHP is loaded to create each page. You can load classes globally, if you need them, but by default, you only load what you need when you need it. This keeps every page as fast as possible, something I was worried about with other frameworks like CakePHP.

    Okay, that's enough ranting. If you use PHP, check out Code Igniter. There are some videos you can watch to see just how easy Code Igniter really is. The user guide is also a pleasant read and explains everything really well.

  • Comments

    1. GeoffC at 5:42am on May 15, 2006

    Nice work.  I have been playing with CI for a few weeks, tis very nice to work with.

    Oh.. and come join us on irc.freenode.net / #codeigniter


    2. Roberto Bechtlufft at 8:17pm on May 18, 2006

    I've been trying to understand MVC for a few weeks, but I always found it too complicated - I'm no PHP pro, I'm just a guy who likes to code now and then. But then I watched the video tutorial in Code Igniters site and, wow, that was a pretty good explanation! I'm already working on my wife's website using Code Igniters. Thumbs up!

    3. Jesse Skinner at 6:40am on May 29, 2006

    I love ruby and rails. But I think php still has it's place. Also, my hosting provider doesn't support ruby. So until my hosting contract expires, I'm pretty much stuck.

    Regardless, when using php, Code Igniter is where it's at.

    4. zidane at 7:20pm on June 1, 2006

    Is it possible to use it with smarty as a template engine ?

    5. Jesse Skinner at 2:54am on June 2, 2006

    @zidane - you know, I was just wondering about that yesterday. I've never used smarty, but from what I can tell, you should be able to load smarty, call smarty functions, assign values and call the display function all from within the controllers of Code Igniter. It seems like it would make a great combination.

    You also might want to ask/discuss this at the Code Igniter forum:


    6. Fredrik Wärnsberg at 5:48am on June 2, 2006

    Why not learn rails? The reason he made rails for ruby and not php was because php wasn't enough for what he was trying to do in the first place.

    7. chris at 12:03pm on June 15, 2006

    Just looking through the documentation for CI for an hour or so and it looks very much like what I've been looking for over the past few weeks. So this is just a quick note to thank you for the headsup!

    8. rabi at 5:38am on August 31, 2006

    This is good stuff. Tried it, it was nice. Anything like this for python? Im not a pro just a designer.

    9. Jesse Skinner at 5:42am on August 31, 2006

    @rabi - I've heard only good things about Django (for Python), though I've never tried it out. I'd like to one day, once I get a web server that supports Python...

    10. Chris Lamb at 4:37pm on October 26, 2006

    Fredrik, I do know Ruby and have built a clients application on Rails.

    The problem for me with RoR was getting a server I could rely upon. It really seemed a patchwork muddling with Apache and fastcgi or lighttpd ... and on....

    Has the situation improved?

    11. Terry Apodaca at 3:24pm on December 6, 2006

    I'm using CI for the first time...to build a website for my family.  I'll keep you posted on my findings and experiences.

    12. Jesse Eickholt at 6:34pm on January 2, 2007

    Just wondering if you'd be willing to share your code for your this blog.  I'm looking to play around with CI and revamp my blog.  I'd love to see what you did.  I nice work with this site.  It's very catchy.

    13. Jesse Skinner at 7:04pm on January 2, 2007

    @Jesse - I've thought about releasing my code one day, but I'd want to package it up and make it more reusable first. I'll keep it in mind, and if I ever do, I'll be sure to announce it on here.

    14. angel at 8:47am on January 31, 2007

    hi, could you pls tell me how to use css with codeigniter? this code does not seem to work->

    <link href="styles.css" type="text/css" rel="stylesheet">

    it's my first time to use a php framework. i'm having trouble installing cakephp and simfony(?) and somehow managed to make codeigniter work (thanks to the video tutorials).

    15. angel at 8:49am on January 31, 2007

    nevermind, i found it out myself. just put the css on the root folder, not on the applications folder/subfolders. =p

    16. jonie at 8:29pm on March 7, 2007

    i watched the CI video and i had an orgasm

    17. Rudy at 3:27am on April 3, 2007

    In Romania 8 March is Mother's Day,  so  I understood why jonie had an orgasm ... :p

    18. martin at 2:09am on May 8, 2007

    hi there jonie......

    r u sure u had an orgasm??wow.......

    well i had a fun time learning CI with the help of the tutorial vids..

    ^^ just had a hard time with the css problem..........

    19. pedro at 3:01am on May 29, 2007


    you guys are talking about CI + orgasms..
    It must be good.

    20. Richard at 4:26am on July 17, 2007

    Hey, I have to agree.  I just downloaded over the weekend.  CI is allot more intuitive than cake, and as it claims - is fast!

    21. Jenny at 1:27pm on August 1, 2007

    From what I read, Smarty and Igniter do not really go well together - too much complexity overhead.

    I have seen sites that used CI - it is fairly intuitive, BUT the front end and back end are not separated, which is very hard to manage. I would stick with smarty and good software design.

    22. squirre at 2:53am on August 22, 2007

    hello, i'm a newbie in codeigniter, found same problem with css
    but i think i know how to do that now...

    i made a newbie tutorial in my blog

    23. kik at 8:08pm on November 23, 2007

    just to mention that CI work pretty well with projax.

    24. Brian at 7:00pm on January 8, 2008

    How is the front end and back end not separated in CI?  It seems that they are, with the back end submitting finished values to the front end view files when finished.

    It looks like it's not as slick as Smarty (ie. <?=$title?> instead of {$title}) but still does the job of separation, or am I missing something?

    25. eenx at 11:21am on March 2, 2008

    I'll try it, thanks for the review

    26. Mohfeza at 11:15am on March 13, 2008

    Could you please
    let me know if I can get CodeIgnitor hosing?

    27. Jesse Skinner at 12:38pm on March 13, 2008

    @Mohfeza - the great thing about Code Igniter is, all you need is regular PHP web hosting, and you should be able to find that anywhere!

    28. Dhila Pamungkas at 8:00am on May 5, 2008

    I'm a real newbie on web programming..
    I've never used PHP before..

    One of my lecturer hired me to do some portal-making, and urged me to finish it this month with the assistance of CI, which I never used before..

    So.. what do you think I should start with?

    29. Jesse Skinner at 8:03am on May 5, 2008

    @Dhila - Start with the CodeIgniter user guide and maybe pick up a good PHP beginner book. A month sounds like a tight crunch for learning and using a new language. Good luck!

    30. JM at 8:48pm on August 4, 2008

    Code Igniter is an excellent framework, I'm using it in my two actual projects.

    31. henrihnr at 12:48am on October 16, 2008

    anyone ever tried using DojoToolkit with CodeIgniter?
    what do you think bout dojoToolkit to work with CI?
    is it a good option? or there's a better option? thx

    32. JM at 8:52am on October 16, 2008

    I didn't use DojoToolkit, but I used jQuery and it fits perfect for CI. I used that combination for all my projects.
    Good luck.

    33. Neighbor Webmaster at 2:05pm on October 9, 2009

    For those who are interested in using Smarty with CodeIgniter, I documented my implementation here http://www.coolphptools.com/codeigniter-smarty . I also include some smarty plugins that make accessing language file information and validation errors easy.

    Commenting is now closed. Come find me on Twitter.