Autoload problem with 3rd party library [SOLVED]

I need to use a 3rd party PHP library and have truble using it combined with Yii.

When including the Library YiiBase::autoload() returns the following error refering to "self::$resources = PagSeguroResources::init();" in the included file PagSeguroLibrary.php:

include(PagSeguroResources.php) [<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory

I suspect that the problem is that Yii is blocking the autoloader used in the library:


	private function __construct() {

		self::$path 	 = (dirname(__FILE__));


		self::$resources = PagSeguroResources::init();

		self::$config 	 = PagSeguroConfig::init();

		self::$log 	 	 = LogPagSeguro::init();



	private function __construct() {

		if (function_exists('__autoload')) {



		spl_autoload_register(Array($this, 'addClass'));


	public static function init() {

		if (!function_exists('spl_autoload_register')) {

			throw new Exception("PagSeguroLibrary: Standard PHP Library (SPL) is required.");

			return false;


		if (self::$loader == null) {

			self::$loader = new PagSeguroAutoloader();


		return self::$loader;



	private function addClass($class) {

		foreach(self::$dirs as $key => $dir) {

			$file = PagSeguroLibrary::getPath().DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$class.'.class.php';

			if (file_exists($file) && is_file($file)) {

				require_once $file;




I have tried changing the way the path is made in the library with no success. Is there a way to bypass Yii::autoload() or do the include in another way?


try this:

Integrating with other frameworks

Great! It works - thanks! :)


require_once(Yii::app()->basePath .'/inc/PagSeguroLibrary/PagSeguroLibrary.php');


This solution worked when doing something similar with Invision Power Board :)