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

Posts Tagged ‘integration’

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

Yii Kohana Bridge updated: full Kohana flavour now added!

I have just pushed some updates to the Git repository.

The entire Kohana distribution is now included. The bridging class is now renamed to ‘Kbridge’.

Not all helpers and libraries will work at the moment, especially the ones that reference Kohana core classes. I am however planning to bridge the core classes and configuration files for tighter integration.

If you have any suggestions please let me know. :)

Related posts

Using Zend Framework with Kohana

Since my previous post on this topic, Kohana has evolved and changed quite a bit, to the point that the instructions provided are no longer applicable.

So here are the updated instructions for those who would like to integrate Zend Framework into Kohana.

1) Put the ‘Zend’ folder in your application’s ‘vendors’ directory.

2) Put the following code into an appropriate place in your application, it could be in the base controller.

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

3) Instanciate the Zend library with the following code:

require_once 'Zend/Mail.php';
$mail = new Zend_Mail;

That’s it! How simple is that? :)

Related posts