为多个codeigniter项目使用相同的配置文件

I'm setting up a project where i wish to use the same codeigniter system + share some common models, libraries and even config files between the different websites.

I have put my system folder and a shrunk in application folder in docs/include/codeigniter and i define the path for the system folder in the index file of every website. I figure, that in order to use the models, libraries and config files from this application folder, i should use the add_package_path() function from http://ellislab.com/codeigniter/user-guide/libraries/loader.html.

But where can i put this call to make sure that it loads as early as possible? I would like to be able to even share the autoload.php config file, but if i call this method in the constructor of the index controller i will receive an error, because CI needs to use some of the config files before starting to load controllers.

I don't know the solution using add_package_path(), but this could work:

Configuration

Firstly, check out application/config/autoload.php for $autoload['config'].

If it for some reason does not suit your purposes: The CodeIgniter config files are also just PHP files. So you can make your own common_config.php file and then just use require '../some_common_folder/common_config.php'; in the configuration files of your CodeIgniter projects.

Models

Again, see application/config/autoload.php for $autoload['model'].

You can also define your own function __autoload($classname) {} in the index.php file of each of your CodeIgniter projects, where you can load/require/include whatever you want.