• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Featured
    • C# Tutorials
      • LinQ Tutorials
      • Facebook C# API Tutorials
    • PHP Tutorials
      • CodeIgniter Tutorials
    • Amazon AWS Tutorials
  • Categories
    • Programming
    • Development
    • Database
    • Web Server
    • Source Control
    • Management
    • Project
  • About
  • Write
  • Contact

CodeSamplez.com

Programming, Web development, Cloud Technologies

You are here: Home / Development / Overview Of Codeigniter 2.0 Features

Overview Of Codeigniter 2.0 Features

March 7, 2011 by Rana Ahsan 3 Comments

Codeigniter 2

At the end of January,2011, Codeigniter has released their new version, 2.0 . As expected, they made a number of major changes, added some awesome features on this new version. Besides, they made some other changes also on development work-flow etc recently. In this article, my concern is to make existing Codeigniter developers familiar with this new version and its features/enhancements, also with the other recent changes. However, new Codeigniter developers can may get some idea too.

PHP Version Supports:

From this new version, 2.0, Codeigniter is going to support only php 5+ . To mention, before, Codeigniter 1.x versions supported php 4 and php 5 both versions. Now, php 4 supports simply gone. So, if you are php developer who writes php 4 compatible codes often, should have refine yourself a little before starting with Codeigniter 2. A simple example of a controller class written in 2 different php version is as follows:

<?php
/*PHP 4 based, won't work with codeigniter 2 */
class MY_Controller extends Controller {

       function MY_Controller()
       {
            parent::Controller();
            // Your own constructor initialization codes
       }
}


/*PHP 5 based, will work with codeigniter 2 and previous versions also*/
class MY_Controller extends CI_Controller {

       function __construct()
       {
            parent::__construct();
            // Your own constructor initialization codes
       }
}
?>

Directory Structure Changes:

codeigniter directory structure
Before, Codeigniter had the directory structure like this: application directory was in {root}/system/applications/ and other system files was in {root}/system/ directory. In the new Codeigniter 2.0, this structure changed and the application directory came free as an external directory. So, now default application directory will be {root}/applications/ and other Codeigniter core files/directories are on {root}/system/ folder. Although it is possible for everyone to made this change themselves, still I think this is a great idea to make this change officially. As you won’t have to look into system directory at all unless you are going there to learn something from the core. This helps developers to navigate application directories from ide(Integrated Development Environment) easily than before. Besides, this will help you to set up multiple web application more easily.

Codeigniter 2 plugins:

If you were using plugins in Codeigniter. You may get surprised to listen that, Codeigniter 2 doesn’t support plugins anymore. Who will do the tasks then? Well, simply use helper and hooks to achieve whatever you need. Won’t be difficult at all, right?

Codeigniter 2 routing enhancement:

There is 2 more useful enhancements on codeigniter 2.

  • common override rules: Now, we can write/override common rewrite/routing rules to the index.php files also. This will be helpful if you are using multiple application in a single installation. Other application specific routing rules can still be written in routes.php in the application/config/ folder.
  • New routing override rule: New default rule added for 404 error pages. That means you can now use “$route[‘404_override’]” to route a 404 page to a specific controller methods you like.

Condeigniter 2.0 Supports caching:

This new version supports dynamic caching. You can have total control of what you are caching. A simple example of how caching works:

if ( ! $myvar= $this->cache->get('myvar'))
{ 
     //assign any kind of data/objects which are to be cached  
     $myvar = 'simple text';

     // Save into the cache for 5 minutes
     $this->cache->save('myvar', $myvar);
}
//use the variable normally

It supports the following forms of caching:

  • Alternative PHP Cache (APC) Caching. To know more details about APC caching, please visit APC caching
  • Memcached Caching. To know more about memcached caching, please visit Memcached Caching
  • File-based Caching. To supports caching in raw text files. It is a good option if you don’t have support for any of the above.

Condeigniter 2.0 Provides 2 different Flavors:

From this new version, there will be 2 different development version will be available:

  • CodeIgniter Core : This development will be move on by support of Ellislab themselve, thus we can say of it as the official version. However, its new releases will be much slower.
  • CodeIgniter Reactor This is the version, where Codeigniter community contribute and enhance the Codeigniter core functionality. This includes a lot of community driven implementation integrated on the core. This version is to be changed/enhanced frequently.

I prefer the reactor version and Codeigniter itself prefer so. Because, it will help you avoid reinventing wheel in many phases of development. Also, even some of the features i have discussed here, are provided by reactor community.


Read The Complete CodeIgniter Tutorials Series By CodeSamplez.com

References:

If you are interested to know every single details about the new changes and enhancements, please visit Codeigniter 2.0 Changelogs. Happy coding 🙂

Share If Liked

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Pocket (Opens in new window)

You may also like

Filed Under: Development Tagged With: codeigniter, php

About Rana Ahsan

Rana is a passionate software engineer/Technology Enthusiast.
Github: ranacseruet

Reader Interactions

Comments

  1. Stas says

    March 18, 2011 at 7:21 am

    Codelobster PHP Edition already supports CodeIgniter 2.0. too.

    Reply
  2. Julian says

    May 22, 2011 at 4:53 pm

    Thanks for the insights !

    Reply
  3. DerekPadula says

    July 20, 2011 at 12:24 am

    That was helpful. I’m working with CodeIgniter 2.0 right now. Thank you.

    Reply

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 3,774 other subscribers

Follow Us

  • Twitter
  • Facebook

Top Posts & Pages

  • How To Work With JSON In Node.js / JavaScript
    How To Work With JSON In Node.js / JavaScript
  • PHP HTML5 Video Streaming Tutorial
    PHP HTML5 Video Streaming Tutorial
  • How To Work With C# Serial Port Communication
    How To Work With C# Serial Port Communication
  • Facebook C# API Tutorials
    Facebook C# API Tutorials
  • LinQ Query With Like Operator
    LinQ Query With Like Operator
  • Using Supervisord Web Interface And Plugin
    Using Supervisord Web Interface And Plugin
  • Get Facebook C# Api Access Token
    Get Facebook C# Api Access Token
  • Getting Started With UDP Programming in Java
    Getting Started With UDP Programming in Java
  • Utilizing Config File In C#.NET Application
    Utilizing Config File In C#.NET Application
  • Generate HTTP Requests using c#
    Generate HTTP Requests using c#

Recent Posts

  • Building Auth With JWT – Part 2
  • Building Auth With JWT – Part 1
  • Document Your REST API Like A Pro
  • Understanding Golang Error Handling
  • Web Application Case Studies You Must Read

Tags

.net angularjs apache api audio auth authenticatin aws c# cloud server codeigniter deployment docker doctrine facebook git github golang htaccess html5 http javascript jwt linq mysql nodejs oop performance php phpmyadmin plugin process python regular expression scalability server smarty socket.io tfs tips unit-test utility web application wordpress wpf

Footer

Archives

Follow Us

  • Twitter
  • Facebook

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 3,774 other subscribers

Copyright © 2023