This is my first-ever blog post. I have been using CodeIgniter for two years now. Although I really like this framework—it provides a fantastic starting point for new programmers—it does have some shortcomings.

I’ve used CodeIgniter following the techniques of Jamie Rumbelow, customizing MY_Controller and MY_Model. I should also mention Phil Sturgeon’s template library, which I consider the best. Additionally, the CMS built on this framework, called Halogy, is my favorite product, and I’m excited that it’s under development again. However, despite my appreciation for CodeIgniter, after extensive research and customization, I’ve encountered a few gaps that I’d like to share.

 

1. Extending Core Classes


Extending core classes is a fantastic feature for programmers, providing control over the framework. However, it becomes a headache when working on multiple projects, each with unique requirements. For every project, I’ve had to repeatedly customize core classes to meet specific needs, which can be time-consuming and frustrating.

 

2. Creating Instance

   
In CodeIgniter, you’ve probably seen this snippet of code to create an instance:
 

$CI = &get_instance();

 

While this allows you to access the parent class anywhere in the application, it’s a cumbersome process. Programmers like me, who lean toward efficiency, would prefer easier access to the instance without manually initializing it every time.
 

I’ve observed how Laravel—a framework I’m transitioning to after two years with CodeIgniter—handles this. Laravel’s static methods don’t require preloading or initialization before use, which is incredibly convenient. In contrast, CodeIgniter’s approach has caused me issues, particularly because I often forget to initialize the instance, leading to errors and wasted time. This is one feature I wish CodeIgniter could simplify.

 

3. File Upload

   

File uploads in CodeIgniter present an unexpected issue. I’m surprised that this hasn’t been widely discussed in blogs, articles, or forums (or maybe I’ve missed it).
 

Here’s the problem: when working with file uploads alongside other form data using the form_validation class, things can go awry. Let me explain step by step:
 

Imagine you have a form with a file input field, text boxes, and other input fields. Using the form_validation class, you can validate the fields. However, to validate the file field, you’re required to use the do_upload method from the Upload class.
 

The issue arises when the validation for text boxes fails but the file is still uploaded to the server. If the form fails validation multiple times, multiple files end up being uploaded, wasting server space. For instance, if the validation fails five times, five files will be uploaded unnecessarily.
 

What I really want is to validate the file field first and only upload the file if the validation is successful. To address this, I had to create a workaround by extending the Upload class.

 

4. Pagination

 

The pagination class in CodeIgniter is simple and functional, but it’s missing one key feature: a "records per page" option.
 

It would be much better if there were a method that allowed users to choose how many records they want to view per page. Unfortunately, I couldn’t find this functionality, so I had to create another workaround for it.
 

These are just a few of my thoughts. I’m not saying CodeIgniter is a bad framework—far from it! It’s an excellent tool that provides a lot of value to programmers. However, as someone who expects a framework to offer both control and ease of use, I think these areas could be improved.
 

I’m sure other developers have their own critiques, and I’m hopeful that EllisLab will address some of these issues in future versions of CodeIgniter to attract and retain more programmers.


Let me know if you'd like further revisions!