Feature
Post

Category
Code

CodeIgniter: PHP Development Fun – Part 1

ci_logo_flameLast night, I had an idea for what I think could be an interesting project, and I was left with a choice: hire someone to build it, or do it myself?

I am not the best developer in the world. My PHP skills are not ninja like in the least, but I have been craving a reason to get back into developing a few of my own things again, as development skills are almost always in demand.

I decided that I would give it a go, and instantly started thinking about all of the files I would need to write. The project files ballooned in my mind, and I felt a little dizzy. I didn’t have time to write a million different lines of code on twenty or thirty files. It was just too much, and while for most programmers, this might have been an easy task, for me, I felt overwhelmed.

It made me a little envious of people that use Ruby on Rails. I had seen the demo videos numerous times where they went and created and felt envy. It just seemed like so much to take in though. I didn’t have time to learn another programming language.

Then I found out about the many different PHP framework systems that are out in the marketplace today, and read that CodeIgniter is the most forgiving. I had to at least give it a chance.

I looked over the installation information for CodeIgniter. It was basically a series of PHP files that are already written for you, and allowed you to easily take advantage of them. They, like other frameworks out today use the model, view, controller system of development, which is new to me, but not too difficult to pick up.

Installing CodeIgniter was as easy as uploading and changing two files. The first file, config.php was just making sure that CodeIgniter understood what domain it was on. I had to change the base_url. And then, because I knew I would want to use a database, I edited database.php with my database information.

After that, I watched the two instructional videos on the CodeIgniter website, and used information within to extract what I needed to do to get the start of my project running.

Within forty minutes, I had already done what would have taken me around a week on and off of PHP development on my own. I still have a long way to go before my project is complete, but CodeIgniter was able to help me get where I am, much faster. Will it continue to save me time, as I continue forward? I am not sure, as I will have to learn more about what CodeIgniter includes, and how to make use of it efficiently, and this learning curve might remove any real time advantage that CodeIgniter implies in using it.

Thankfully, there is a pretty active, and helpful community of users that can hopefully reduce my learning curve, and help me jump over any hurdles. They were already helpful in getting around errors in the demonstration videos due to depreciated information held within.

As I progress in the project, I hope to put up code samples, things I have learned, as well as show the project once it is complete.

  1. By Steve B posted on January 29, 2009 at 12:30 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    I had the same exact experience as you. My PHP skills were not ninja like, I had limited knowledge of PHP OOP, I had no knowledge of the MVC framework, and my applications were starting to get a little out of hand and starting to become very messy.

    CI was a step in the right direction. I have learned a ton of new PHP techniques, including OOP, CI makes learning the MVC model super easy, and my projects have become so much more manageable.

    One of my favorite things about CI is how easy it is to write commonly used html objects. Takes anchors for example. Before I was writing them the usual way now, I can use: anchor(‘controller/method’, anchor name); Boom, done, so simple. CI takes care of the monotonous web dev tasks.

    I look forward to your code examples and upcoming posts about CI. CI FTW!

  2. By Chung Bey Luen posted on January 29, 2009 at 12:44 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    I think I should check out CodeIgniter as well and see what it can offers. My PHP skill is not good enough compared to my Java skill.

  3. By Luke L posted on January 29, 2009 at 2:50 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    After using CodeIgniter for several projects I’ve recently switched to Kohana (http://kohanaphp.com/). It’s a port of CI but written for PHP5 with several other tweaks (which ultimately make sense once you become adjusted to them i.e. the View system). In fact, I’m part way through rewriting my blog in Kohana at the moment.

  4. By Mike Stempień posted on January 29, 2009 at 3:57 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    Good choice, it is really great as a first framework and it has one of the best documentations I ever seen. Can’t wait what will version 2.0 bring.

  5. By Matthew Pennell posted on January 30, 2009 at 5:03 am
    Want an avatar? Get a gravatar! • You can link to this comment

    One of the most attractive features of CodeIgniter is that it will shortly be the engine that runs ExpressionEngine. This means that anyone with CI skills can instantly turn their hand to developing add-ons for EE – quite a lucrative area of growth once EE hits 2.0.

  6. By Wiggum posted on February 2, 2009 at 5:52 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    Ehh…CI is based entirely on PHP4 and will be its ultimate downfall. Any PHP application/framework built on PHP4 and its horrific object model should be avoided at all costs. PHP4 is dead and was an embarrassment. Let’s stop pushing out more PHP4 applications when PHP6 is around the corner.

    CI also has some really odd ‘abstraction’ choices and makes a half attempt at the MVC design pattern when it comes down to it. Most CI devleopers end up stuffing their controller files to the brim with spaghetti code anyways rendering any advantage of MVC moot.

    The good thing about CI is that it at least gets PHP developers thinking about cleaner code and thinking about MVC. Now getting PHP developers to actually understand MVC is another matter!

    If you truly want MVC, just use Struts and be done with it. :)

  7. By Jake Rutter posted on February 5, 2009 at 11:54 am
    Want an avatar? Get a gravatar! • You can link to this comment

    I just used code igniter for the first time to build: dogfriendlyparks.com. The learning curve is pretty easy, as long as you are familiar with how MVC works. I had prior experience with ruby on rails, and I found it very similar – except for the php part. Code Igniter has a great support community too!

  8. By Colin posted on February 7, 2009 at 4:16 am
    Want an avatar? Get a gravatar! • You can link to this comment

    CI is based entirely on PHP4 and will be its ultimate downfall.

    Not at all true. If you delete the Base4.php file, you could then say CI is based entirely on PHP 5. It “runs” on PHP 4, which means any kid getting his hands into programming can use it on their $7/mo shared hosting account. It also means it can be dropped right into old systems reliant on PHP 4. Sure, CI might benefit from some design patterns if it left PHP 4 in the dust (see Kohana), but that’s a wholly different argument.

    CI also has some really odd ‘abstraction’ choices and makes a half attempt at the MVC design pattern when it comes down to it. Most CI devleopers end up stuffing their controller files to the brim with spaghetti code anyways rendering any advantage of MVC moot.

    So the fact that inexperienced developers improperly structure their apps has to do with a flaw in the framework? No. It’s actually a testament to CI’s flexibility.

  9. By Mahbub posted on March 12, 2009 at 3:26 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    @ Wiggum

    To know a true MVC, we don’t need to study struts. There are other sophisticated Frameworks like Zend, Kohana, CakePHP which have better OOP practices. CI is getting better and better. With the new release of 1.7.1, I’m convinced that CI can adopt the need of time. I’m not a die hard fan of CI but I find it very friendly, well documented and very large community support which makes it a pretty good choice.

  10. TrackbackCodeIgniter: Interacting With a Database | Devloungesignal response » Blog Archive » Igniter.