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

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();
}
  • Digg
  • DZone
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter

Related posts

Tags: , , ,

Comments Section

3 Responses to “Using Zend Framework 1.8+ with Kohana”

Sidebar might be covered by comments ... consider it a feature! ;)
  1. 1

    Personally, for version 3 I would create a module and use the init.php file in that module to contain your code above.

  2. 2

    Thanks for this guys.

    What would be the simplest way to integrate Doctrine into Kohana-3?

  3. 3

    I’ve done a lot more flexible autoload for ZF, without renaming the library files and folder or searching and replacing the code in them. Just overwritten the original auto_load function with my own.

    Zend Framework with Kohana PHP 3

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>