Import/include Files - Third Party Libraries

Hi All,

I have a problem related to include the code from a third party. I have followed this wiki article but I don’t get to solve the problem.

The third party code has the following important files:


    require 'PPAutoloader.php';



class PPAutoloader {

    private static $map = array (

        'class' => 'route',



    public static function loadClass($class) {

        $class = strtolower(trim($class, '\\'));

        if (isset(self::$map[$class])) {

            require dirname(__FILE__) . '/' . self::$map[$class];



    public static function register() {

        spl_autoload_register(array(__CLASS__, 'loadClass'), true);



Using a pure PHP application (without Yii), I only need to inlude this line:


In order to access to every class included in the class map PPAutoloader.php

Trying to using this with Yii, in a controller I have included this lines:



Unfortunately I always get the typical error:

Error 500

YiiBase::include(Receiver.php) [function.YiiBase-include]: failed to open stream: No such file or directory

Due to the third party files are not included correctly.

What I’m doing wrong? any suggestion is welcome!


Try this:


Yii::registerAutoloader(array('PPAutoloader', 'loadClass'));

That works!!! great!!! Your incredible! Thank you so much :)