kohanakohana-3flickrphpflickr

Including the phpFlickr library in Kohana


I'm beginning a website using the Kohana Framework, and I couldn't find how to include external libraries "the proper way".

I want to use the phpFlickr library to allow my website to interact with Flickr.

If there was a better way to include the files than:

require_once("path/to/phpFlickr.php");
// Fire up the main phpFlickr class
$f = new phpFlickr($key);

It's OK to do it that way I guess, but if I could say to Kohana, "the phpFlickr files are there, go get them on your own when you need it", it would be better.

Anyone can help me with that?

Thanks.


Solution

  • We use it in the same way as detailed here. So, like the following:

    $path = Kohana::find_file('vendors', 'flickr/phpFlickr');
    if($path) {
        ini_set('include_path',
        ini_get('include_path') . PATH_SEPARATOR . dirname(dirname($path)));
        require_once 'flickr/phpFlickr.php';
    }