Edson Alanis
Edson Alanis

Reputation: 11

Composer with Koseven (Kohana)

I'm developing an application where I started using Kohana and now Koseven, and I need to use an api that was available in the composer, I followed the steps to download the files I created a folder to sell inside the application, and put in the bootstrap.php code to call the autoload of the composer. But after doing this when trying to use a class of this api error of "class not found" occurs. I do not know what else to do, can you help me?

Upvotes: 1

Views: 863

Answers (2)

yourcomputergenius
yourcomputergenius

Reputation: 333

In order to use composer with Kohana or Koseven, you need to call composer's autoloader from within bootstrap.php.

After Kohana::modules($modules); and before Route::set, insert the following code:

/**
 * Autoload composer libraries
 *
 */
require APPPATH . 'vendor/autoload.php';

This assumes your composer install command is run the from the root of your app, and it uses the default vendor directory.

Upvotes: 1

bato3
bato3

Reputation: 2815

Probably you must add this to your composer.json. (Check inc composer doc.) I don't know, because in modules directory I have second instance.

"extra": {
    "installer-paths": {
        "modules/{$name}/": ["type:kohana-module"]
    }
},

And enable module composer as first:

Kohana::modules(array(
    'composer'   => MODPATH.'composer',       // 
    'auth'       => MODPATH.'auth',       // Basic authentication
    'cache'      => MODPATH.'cache',      // Caching with multiple backends

It works for me ko3

Upvotes: 0

Related Questions