[Quick Tip] Add Composer Dependency Manager Support To Kohana

Composer is a super cool way to manage dependencies for your applications. Kohana’s autoloader does not support Composer’s way of autoloading, so if you’re wanting to use composer packages in your application you’re going to run into issues.

However, it’s really really simple to add support. Simply open your application/bootstrap.php file, and (I added this after Kohana registered its autoloader) add

require [FULL_PATH_TO_COMPOSER_FOLDER].’autoload.php’;

Where, of course, [FULL_PATH_TO_COMPOSER_FOLDER] is the actual absolute path to Composer’s auto-generated auto-loader files.

Voila! You should now have Composer support in your Kohana app! 🙂

Leave a comment


  1. Mike

     /  June 24, 2013

    I simple use “require DOCROOT.’vendor/autoload.php’;” in the bootstrap.php file so that it works on multiple server directory structures.

  2. If I use this I get some other errors when loading other classes. For example one I have directly on classes/ folder on application. I have to update composer.phar and do and update, it’s working for you with last composer version and update? Thanks.

  3. Solved, the class I was using had the same name of one from PHPUnit project…. weird conflicts. Thanks.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: