Overwrite CodeIgniter Common.php

There's no officially supported way to do this by the built in extending mechanisms. Consider some other way to achieve your goal.

However the functions inside Common.php are all wrapped inside an if checking if the function is already exists or not so you can do the following:

  1. Create your MY_Common.php put somewhere in your project (maybe application/core/ to mirror other similar extends)
  2. Open your index.php file in the root of the project
  3. insert include APPPATH.'core/MY_Common.php'; before the closing
    require_once BASEPATH.'core/CodeIgniter.php'; line

Now if you have you have a load_class function in your MY_Common.php it will shadow the original version.

Tags:

Codeigniter