3
votes

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.

2
oh.. I got it. include_once './vendor/autoload.php'; $tmh = new tmhOAuth();Denis

2 Answers

5
votes

Better to use Kohana::find_file:

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

This post helped me to figure this out

include_once './vendor/autoload.php';
$tmh = new tmhOAuth();