Composer breaks exisiting autoload in Codeigniter
codeigniter, composer-php
Solution
__autoload is the old, deprecated way of doing autoloading, because you can have only one.
You should register your autoloader using spl_autoload_register. e.g.:
function customCIAutoload($class)
{
if(strpos($class, 'CI_') !== 0)
{
@include_once( APPPATH . 'core/'. $class . EXT );
}
}
spl_autoload_register('customCIAutoload');
This way your autoloader and composer's will coexist happily.
Problem
I was using Codeigniter to do autoloading for some core classes using the method described here: http://philsturgeon.co.uk/blog/2010/02/CodeIgniter-Base-Classes-Keeping-it-DRY ``` function __autoload($class) { if(strpos($class, 'CI_') !== 0) { @include_once( APPPATH . 'core/'. $class . EXT ); } } ``` However, once I installed composer (in order to use Eloquent), this funcitonality no longer works. Any ideas? Thanks!