Five days of Code Igniting

Filed under: Development — Micheal on February 29th, 2008

CodeIgniter is Hot!

For the longest time I have searched for a suitable framework for rapid development that could scale easily. About 1.5 years ago I sat down and wrote my own. My goal was for it to have a small foot print, use MVC architecture, be module, allow for easy template management and also for easy routing while using mod_rewrite. In the end I achieved all these things except the MVC was more like VC and realistically most of the time more V.

About 4 months after I finished a modest sized (~7,000 lines) program sitting on top of my framework, I discovered CodeIgniter. I nearly cried, actually I think I did. I could have written the same problem in half the time. I felt like I had reinvented the wheel. I wrote my own libraries, routing, helpers, etc and CI has everything, including an awesome MVC architecture that is actually MVC!

I have been looking forward to the opportunity of using CI for a large sized project. After several months of planning with a client, I broke ground recently on a good sized project that will probably last several months. I am amazed at how much I achieved in 5 days. What I enjoy most about CI is how limited its functionality is; there is no template system (there is a template parser) and no user management system (there is a session library).

My focus this week was laying the foundation. This is a large program that will be used by many requiring varying levels of access and must also be HIPAA compliant. I wrote the following:

Template System

  • Manages assets (CSS, JS, images, etc) based on the application. CI allows for multiple applications utilizing the same core, I wanted to have the ability to use multiple templates under one app.
  • Dynamically creates navigation based on the URI, will create unlimited levels, can activate a particular item if found in the URI ~~ Plenty of recursion here
  • Just one call for the view
    • $this->template->view(’view_name’, $data, false, ‘optional template name’);

User Management

  • Security is number one priority here through a combination of hooks, DB session library, and encryption library. Did I mention I love CI hooks!
  • Access control, oh golly gosh. This is really the reason I spent so much time writing the template and navigation libraries. Based on the users group or permission id found in the DB session, not only will it restrict access but will automatically render the navigation elements based on the users permission. A hook will check the users id against the requested controller and redirect if necessary.

It’s funny, during this week I was able to get very deep into CI very quickly. I wrote some awesome libraries and even found some bugs in the core that was easily fixed because CI’s community had already discovered them. Needless to say I am very pleased with CI and look forward to further development.

If you PHP and have even a slight handle using OOP, check out CodeIgniter!