why not make a common way for including external classes/scripts, even if they are a bit complex (several files/folders).
Namely set a folder in the application dir, let’s call it my_classes, where to put all the stuff, and to extend the php.ini include_path?
I usually do it with a pre-controller hook that looks as follows:
application/hooks/MyClasses.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class MyClasses
{
/**
* includes the directory application\my_classes\ in your includes directory
*
*/
function index()
{
//includes the directory application\my_classes\Swift\
//change the ';' on ':' to use in LINUX environment
ini_set('include_path', ini_get('include_path').';'.BASEPATH.'application/my_classes/');
}
}
application/config/hooks.php
//..
$hook['pre_controller'][] = array(
'class' => 'MyClasses',
'function' => 'index',
'filename' => 'MyClasses.php',
'filepath' => 'hooks'
);
//..
