PHP Made Amazingly Easy, Efficient, and Fun With CodeIgniter

CI Logo

EllisLab Inc., the same group that has created ExpressionEngine, is at it again by providing people with a free and open source PHP framework called CodeIgniter. This open source PHP framework allows users to create PHP-based applications without many of the complaints I already have with PHP. The best part is that you don’t really have to sacrifice anything to utilize this framework, and it has an amazing community behind it.

Overview

For the longest time, one of my main complaints with PHP has been that it isn’t as user friendly as, say, HTML is, for example. Well, that still remains true, but, for now, we have CodeIgniter. What is CodeIgniter? Well, let’s just say that it allows you to avoid quite a few of the complexities with PHP coding, and, instead, allows users to rapidly program applications. Even more importantly, it doesn’t sacrifice speed or functionality to accomplish this.

Simplicity is at the forefront of CodeIgniter’s design. It is really easy and, dare I say, fun to use. I actually feel like I’m using a language that makes a lot more sense than I would have if I was to take on a project with PHP alone. The documentation is fantastic, and while I wish there were more video tutorials available on the CodeIgniter site, they’re enough to show users what is possible with the CodeIgniter framework. I must say, though, the documentation for CodeIgniter has been very helpful.

One of the most difficult parts of PHP programming was the that connecting PHP with MySQL was a pain in the behind. Many times I began projects that utilized a MySQL database, and I usually gave up once I got to the point of tying those two together. This is no longer a problem. There are easy to use functions that allow data to be stored, retrieved, and removed from a database. It still isn’t as easy as I would like it to be, but it is a huge improvement.

One of the other reasons that I like CodeIgniter so much is that it is fast. I certainly haven’t personally put it through its paces, yet, but I am impressed with what I have seen so far.

Finally, I have nothing but good things to say for CodeIgniter’s community. The forums are a great place to ask questions, and there are plenty of people who have posted great tutorials on their sites.

There has been plenty of praise going around for CodeIgniter, and I will yet another to add to that praise.

Issues

CodeIgniter, as much as I like using it, is not perfect. I’ve read plenty of reviews, and most have great things to say about CodeIgniter, but there are some people who notice that some advanced functionality is left out:

What is wrong with Code Igniter you may ask? Well it seems like it is fast because it strips out so much stuff for you. By default there is no support for a layout template in which your views are embedded (although a quick Google brings us to this), and models must be manually loaded. They don’t connect to the DB automatically, so you must also do this. Therefore, you must also close the DB connection.

In CodeIgniter’s defense, I haven’t found any inaccessible functionality, but, then again, I am not doing any crazy advanced stuff quite yet. Also, if you are a PHP coding ninja, you probably would opt to use PHP in its entirety.

[Update: Several people have pointed out that CodeIgniter does not have the aforementioned problem (anymore). I haven't experienced any of those issues. Other people can talk about that in more detail. This is just a heads-up.]

Potential

I believe that CodeIgniter still has some growing to do, but I also think there is a lot of potential with a framework like this. There are alternatives like CakePHP and Symfony. (Several bloggers have posted great comparisons of each framework.) I will admit that I have not tried those yet (I based my decision to use CodeIgniter from the start by reviews of others), but I am pleased with what I have seen so far, and I am using it to explore PHP further and, potentially, create a custom CMS solution for a site I am working on in my spare time.

Oh, and did I mention that ExpressionEngine 2 is being rebuilt with CodeIgniter? When a company utilizes their own technologies to create products for consumers—all while allowing users to explore and utilize it—this really speaks volumes. It is all pretty cool.

If I happen to try out the other frameworks, I will post my thoughts, but, for now, CodeIgniter works well for all that I want to accomplish.

If you’ve tried CodeIgniter, Symfony, CakePHP, or any other PHP framework, let us know how your experience went.

Comments

  1. James Mowery says:

    If/when I finish the custom CMS I’m working on, I’ll post a comment here, but that might be several weeks to months away.

  2. Jeff Chandler says:

    Sounds great. I still have yet to dive into PHP to create anything other than an echo Hello World statement. Perhaps I should give CodeIgniter a try, just for a little while to play around with it. I should also do a local install of ExpressionEngine just to see what thats all about as well.

  3. Thanks very much for the headsup about this application. While my husband can code by the seat of his pants, whenever I get to PHP it will be most useful to tap into something like the above.

    I’ll tweet about this as well.

    Best wishes, Barbara

  4. Anonymous says:

    check out kohana, a originally based on codeigniter, but it has been completly rewritten for php 5 so it addressed some of the issues you pointed out. http://www.kohanaphp.com

  5. walesmd says:

    The way this article is written it makes it sound like CodeIgniter is something new – it’s been out for well over a year now.

    CI is an abstraction of the core of ExpressionEngine – and now that CI is well-matured, EllisLab has decided to completely rewrite EE2 on top of CI.

    As for the “issues” – there is no support for a template to place your views within because all CI does is echo out your view – it’s not there is lack of support for what you mention, it’s that CodeIgniter empowers you to utilize your views in what ever fashion you decide. Whether your view is a chunk of xHTML, RSS, or even JSON – CodeIgniter lets you do it and by enforcing a “yield” system like Ruby on Rails, it would severely limit the flexibility it gives you, as a developer.

    Models don’t need to be manually loaded – you can autoload models if you feel the need to do so. No – the models aren’t automatically loaded based on the controller, because CodeIgniter doesn’t limit you to one controller, one model. You could have numerous models for any particular controller (and you often would – like a blog, would have a model for posts and a model for users both of which would be referenced in displaying a post).

    Finally, no your database connection does not have to be manually closed. CodeIgniter is configured by default for persistent connections but it is as simple as switching a boolean (literally, TRUE to FALSE) to disable this feature.

    All in all – it’s nice to see other people spreading the word about CI but this article wasn’t researched at all.

  6. James Mowery says:

    You are wrong. I am no expert on PHP. These were my first impressions.

    Also, I am fully aware that CodeIgniter is not new. Nowhere in my article did I state as such.

    I am not knowledgable in web programming. So, I did not comment on any of the intricate problems that professional PHP programmers have. Please refer to the following paragraph in this article, for example:

    In CodeIgniter’s defense, I haven’t found any inaccessible functionality , but, then again, I am not doing any crazy advanced stuff quite yet. Also, if you are a PHP coding ninja, you probably would opt to use PHP in its entirety.

    Everything you just mentioned, I know very little about. I also pointed out that PHP experts would have little to no need for this kind of framework.

    So, please, show some respect for people who take the time to write this content. You didn’t offer anyone any other suggestions as to a better system in your comment.

    You incorrectly bashed my article—you assumed I was some PHP code ninja. Now, if you had properly read my article, you would have realized that I wouldn’t know much of anything you just commented on.

    I am having a great time using it, and that is an opinion, and all my opinions in this article were correct, as they are opinions. All my research was based off of using it for several weeks.

    Also, I posted links to other resources where there are people with much more information and analysis of CodeIgniter and its competition. So, again, you are wrong when I say I didn’t research. I always do research, and I did more research than time you spent reading my article, obviously.

    Finally, I quoted the statement about the database not being connected automatically. Do not claim that I made that statement.

    Please show respect for what you read, and properly read it before you comment. This is a perfect example of what I was going to write about when people comment on articles before properly reading them. Just disappointing from you.

  7. James Mowery says:

    What I would really like to see is a way to use CodeIgniter to build WordPress plugins. Unfortunately, I don’t think this would be easily accomplished, but it is a nice thought. I could see myself creating some wicked awesome programs with CI.

    I am also considering creating a small photo gallery with a commenting and rating system. Awesome stuff.

  8. James Mowery says:

    Thanks! Hopefully something like this could inspire more code monkeyless people to get in there and make some cool web applications.

  9. James Mowery says:

    Thanks for posting that. It must be pretty cool when new PHP frameworks are based off of other PHP frameworks. I’m sure that it probably addresses some of the issues I had, and potentially some of the issues that walesmd had.

  10. James Mowery says:

    I have updated this post. Some people are claiming that I wrote that CodeIgniter can’t connect to a MySQL database or some other nonsense. I quoted that from another blog that recently reviewed CodeIgniter. I had no problems, but I just wanted to point out the fact that others have, in fact, had issues with CodeIgniter.

    I’m pleased with the framework, and I have not had any issues so far. That is the point of this entire article. So, hopefully that clears up any concerns.

    I am also interested in checking out KohanaPHP (which is based off of CI as well).

  11. James, you quoted an article without verifying the information within that article. What if Ars Technica wrote an article about the Macbook Air and within that article they said:

    The Macbook Air is great, and we like it, but some people are having some issues with it: “What is wrong with the Macbook Air you ask? Well it seems like its fast but that’s because it can’t run any applications. All it does is boot up and then you look at a blank screen. Sure – it does that quick, but you’re not going to get very far with it. Oh yeah, it causes cancer too.”

    Do you think that author would have a job in the morning? Absolutely not. Part of researching an article is verifying those inputs you receive from others and ensuring what you are reporting is factual. The use of a quotation is to provide an additional level of information to your original article, the corraboration another name gives your article, even if it is an opposing viewpoint. It’s still up to you to verify you aren’t being fed a line of BS. If you just start throwing quotes in without verifying anything: well, my blog has tutorials that will answer all of your programming questions, no matter what language they are in, please quote me and link to it with “PHP Freelancer” – thanks.

    So, please, show some respect for people who take the time to write this content. You didn’t offer anyone any other suggestions as to a better system in your comment.

    I didn’t need to – I thought it was pretty clear I was sticking up for CodeIgniter.

    You incorrectly bashed my article—you assumed I was some PHP code ninja. Now, if you had properly read my article, you would have realized that I wouldn’t know much of anything you just commented on.

    So you write an article about a PHP framework, half of which bashes the framework, and you don’t know enough about either PHP, CodeIgniter, or any other framework to validate any claim – whether it be positive or negative. Was the article not properly read or was it not properly authored?

    Finally, I never claimed you made those statements. It’s obvious they are quotes but I think I’ve already proven my point as to why we should validate quotes used in our articles.

    Like I said – not a bad article, any article that gives CodeIgniter more publicity is a good article, but it could have been researched better. The benefits of using CodeIgniter (found within your Overview section) are nothing more than your opinion with a fleeting mention and link to people’s praise. The issues of using CodeIgniter (none of which are factual) get their own heading, and a direct quote within the article. Finally, the potential within CodeIgniter’s future gets its own heading as well. The structural design of this blog post leads one to believe “CodeIgniter kind of sucks now but it’ll be great in the future,” and the content within the post itself does nothing to dissuade the user from this belief.

    I’m not bashing you personally, or the article really, just defending an excellent framework that should have been given a fair trial.

  12. You could pull the libraries and helpers out of CodeIgniter and use them within WordPress.

    Personally, I would recommend just switching to ExpressionEngine. :D

  13. James Mowery says:

    Sorry. I can’t entertain you any further:

    So you write an article about a PHP framework, half of which bashes the framework…

    you don’t know enough about either PHP, CodeIgniter, or any other framework to validate any claim.

    Yeah, you pretty much discredited yourself there by publishing false information that you presented in a factual manner—I believe they call that defamation!

    Who do you think you are? You act as if you know me personally. How do you know my level of knowledge on PHP, CodeIgniter, or any other framework? You are sorely mistaken, and, again, wrong. I hate to say it, but you are really making yourself look like an idiot here.

    Your assumptions are foolish, and your reputation is really questionable in my eyes. Here’s a tip in life: never make assumptions. This is one of those moments where you should regret it. I’ll have you know that I am very proficient in C++, jQuery, HTML, CSS, and Objective-C programming. I understand core concepts of programming languages, and I also study artificial intelligence in my free time. I dedicate my life to studying technology and representing the truth, and those who really know me, know exactly that.

    You are free to criticize me and my content. You can do it all you want. But you will not misrepresent me with false and defamatory statements.

    Performancing is a place for bloggers to communicate and exchange ideas, but posting defamatory content about anyone is not welcomed (and it is also illegal). You will do yourself well to stop digging a hole for yourself. I take my reputation with the utmost seriousness. So, this is the end of the discussion.

    Oh, and before you comment anywhere again, I must implore that you read this: http://w2.eff.org/bloggers/lg/faq-defamation.php. Thanks for your time.

  14. James Mowery says:

    Sorry that you felt the urge to make a joke of the situation. I would have thought that someone so involved with the CodeIgniter community and who served our country would use better judgment. Because you are associated with CodeIgniter (and potentially an employee) there is a serious conflict of interest. I have praised the CodeIgniter community, but you insist on attacking me.

    I was actually shocked to learn that you are a prominent member of the CodeIgniter community, but then come here to attempt to defame me. You might have the best intentions, but you are wrong, and I, again, must implore that you get your act together. I take my reputation very seriously, and I will not have someone come here and try to bully me around with false accusations.

    Again, conflict of interest—your judgment is clouded. I could have easily not written anything about CodeIgniter while opting to write about Symfony or CakePHP instead. So, would you still have been here attacking me? I doubt not! So, then you must ask yourself, why are you here attacking me?

    Regardless, I have temporarily blocked your account so you can calm down. I also feel that you are misrepresenting the CodeIgniter community and EllisLabs with your defamatory statements. It is very unprofessional behavior. I will restore access to your account in a day or two (after you calm down), but please get a grip on yourself. I must insist that you talk to Leslie (owner of EllisLabs [also owner of CodeIgniter]) before you take any further action.

    Thanks.

  15. Anonymous says:

    @Article
    Hello James,

    Thanks for the article but as readers I think we were expecting some sort of “review” with substance of CodeIgniter. Instead what we got was a half-baked mess of thoughts and quotes which left us confused as to your conclusion of the framework.

    For the longest time, one of my main complaints with PHP has been that it isn’t as user friendly as, say, HTML is.
    Apples vs. Oranges (Half-baked thought)

    Also, if you are a PHP coding ninja, you probably would opt to use PHP in its entirety.
    Maybe you can help me define “coding ninjas”. Wouldn’t it take “coding ninjas” to create CI? Did they just create it for giggles? Didn’t you say it’s great that EllisLabs uses it for ExpressionEngine? (Half-baked thought)

    @Comments
    All I am going to throw out there is that your “defamation” claim is completely bogus. walesmd simply made a valid assumption based on your comments:
    I am not knowledgeable in web programming.
    Everything you just mentioned, I know very little about.
    I am no expert on PHP.
    Assumption by walesmd: So you write an article about a PHP framework, half of which bashes the framework, and you don’t know enough about either PHP, CodeIgniter, or any other framework to validate any claim – whether it be positive or negative.

    So, please, show some respect for people who take the time to write this content.
    Please show some respect to the people that take the time to create the code, documentation, and other resources that help you create web applications (PHP, CodeIgniter, etc…) instead of providing false information that indefinitely confuses others who may read your article (and who ultimately may rely on your article to make their framework decision just like you have).

    I hope the best for you and for your new CMS project.

Speak Your Mind

*

Current ye@r *