Latest in branch 2
2.2.6
Released 31 Oct 2015
(10 years ago)
SoftwareCodeIgniter
Version2
Supported
PHP versions
PHP 5.1.6+
Initial release2.0.3
20 Aug 2011
(14 years ago)
Latest release2.2.6
31 Oct 2015
(10 years ago)
Support statusNo
Source codehttps://github.com/bcit-ci/CodeIgniter/tree/2.1.1
Documentationhttps://codeigniter.com/userguide2/
CodeIgniter 2 ReleasesView full list
SEE ALSO: PHP MySQL

What Is New in CodeIgniter 2

CodeIgniter 2 represents a significant modernization of the framework, focusing on PHP 5+ support and a cleaner codebase. It's a mandatory upgrade for anyone running older versions to maintain compatibility and security.

Category Key Changes
Core Requirements Now requires PHP 5.1.6 or newer. Dropped support for PHP 4.
New Features Added the get_where() method, list_fields(), and application packages.
Improvements Refactored core classes to use CI_ prefix, enhanced security libraries, and better error handling.
Deprecated Items The $autoload['core'] configuration array was deprecated in favor of $autoload['libraries'].
Bug Fixes Numerous fixes across Database, Email, File Uploading, and Form Validation classes.

Why Did CodeIgniter 2 Drop PHP 4 Support?

The single biggest change was ditching PHP 4. This was a strategic move to leverage the object-oriented features and performance improvements in PHP 5. It allowed the core team to refactor the framework's internal code, making it more robust and modern.

In practice, this meant developers could finally write proper classes that extend native CodeIgniter libraries without the old workarounds. The entire ecosystem shifted to embrace more modern PHP development patterns.

What Are the Key New Features in the Database Layer?

The Active Record database class got some seriously useful additions. The new get_where() method combined a where() clause and get() into a single call, simplifying a very common operation.

Another great addition was list_fields(), which fetches the field names for a particular table. This is super handy for dynamic form building or data processing scripts where you need to know the table schema on the fly.

// New in CI 2: get_where()
$query = $this->db->get_where('my_table', array('id' => $id), $limit, $offset);

How Did CodeIgniter 2 Improve Application Structure?

Application Packages were introduced, letting you modularize your code into reusable bundles. A package can have its own models, libraries, views, config files, and more. This was a step towards a more organized application architecture beyond the standard MVC folders.

The autoload mechanism was also cleaned up. The old $autoload['core'] config was deprecated in favor of using $autoload['libraries'] for everything. This reduced confusion and streamlined the boot process.

Were There Any Security Enhancements?

Yes, the Security and Input classes saw important hardening. The XSS filtering was improved, and the core system was made more resilient against various attack vectors.

These weren't always flashy changes, but they mattered. The community had identified potential weak spots, and the 2.x branch addressed them directly, making it a more secure foundation for production applications.

FAQ

Is CodeIgniter 2 a direct upgrade from version 1.7.2?
Mostly, but not entirely. The main breaking change is the requirement for PHP 5.1.6+. If your server and application code are already on PHP 5, the upgrade path is relatively smooth. You'll also need to move any 'core' items in your autoload config to 'libraries'.

What happened to the "core" autoloading configuration?
It was deprecated. You must now load all libraries, including former 'core' classes, using the $autoload['libraries'] array in your config/autoload.php file. This change unified the loading process.

Can I use my existing CodeIgniter 1.7.x modules and extensions?
Many third-party libraries will work, but some might break if they were built for PHP 4 specifically or relied on deprecated internal methods. Always test them thoroughly in a development environment first.

Why is the get_where() method such a big deal?
It encapsulates a very common database pattern into a single, clean method call. It reduces code repetition and potential for error, making everyday database queries quicker to write and easier to read.

Where can I find the full list of changes for each point release?
The official CodeIgniter 2 changelog provides a exhaustive, version-by-version breakdown of every new feature, change, and bug fix. It's the definitive source for all updates. View the changelog.

Releases In Branch 2

VersionRelease date
2.2.631 Oct 2015
(10 years ago)
2.2.508 Oct 2015
(10 years ago)
2.2.420 Aug 2015
(10 years ago)
2.2.313 Jul 2015
(10 years ago)
2.2.215 Apr 2015
(11 years ago)
2.2.126 Jan 2015
(11 years ago)
2.2.006 Jun 2014
(11 years ago)
2.1.429 Jul 2013
(12 years ago)
2.1.308 Oct 2012
(13 years ago)
2.1.229 Jun 2012
(13 years ago)
2.1.113 Jun 2012
(13 years ago)
2.1.022 Nov 2011
(14 years ago)
2.0.320 Aug 2011
(14 years ago)