Read the latest web development and design tips at Fred Wu's new blog! :-)
Poke me on GitHub

Posts Tagged ‘autoload’

Using Zend Framework 1.8+ with Kohana

Even though the method outlined in my previous post would still work, I thought I’d post a cleaner one to handle the auto-load of Zend Framework classes in Kohana.

The code works with Zend Framework 1.8+, where a new Autoloader class has been introduced.

You can put the code in an appropriate place in your application, it could be in the base controller, or if you’re using Kohana 3.0, in the bootstrap file.

You now no longer need to manually ‘include/require’ Zend Framework files. :)

if ($path = Kohana::find_file('vendors', 'Zend/Loader'))
{
	ini_set('include_path',
	ini_get('include_path').PATH_SEPARATOR.dirname(dirname($path)));

	require_once 'Zend/Loader/Autoloader.php';
	Zend_Loader_Autoloader::getInstance();
}

Related posts