phpkohanacomposer-php

Load and call external library at Kohana


I can not figure out how to include and call external library at Kohana.

I am using Kohana, by using composer I have loaded tmhOAuth library to vendor folder. Composer said - autoloader file was created, but i have no idea - does Kohana loaded that autoloader file or not.

path to autoload -> vendor/autoload.php
path to library file -> vendor/themattharris/tmhoauth/tmhOAuth.php

1) Does I have to include something? If yes - what? autoloader file or file with library classes? 2) How to call some library's method from my controller?

Sorry I'm very new to Kohana.


Solution

  • Better to use Kohana::find_file:

    require_once Kohana::find_file('vendor', 'autoload');
    $tmh = new tmhOAuth();