Question about creating an extension from an existing library.

I want to take the HybridAuth library on sourceforge.net and turn it into a Yii extension. However, the library does not follow Yii standards. For example, a class named Hybrid_Auth is located in a file named Auth.php.

I really don’t want to modify the source so it can easily be updated later. If I try to instantiate a Hybrid_Auth object, it will look for a file called HyBrid_Auth.php, which doesn’t exist. How could I get Yii to look in the Auth.php file for the Hybrid_Auth class? Thanks.

you can make it a component in yii

all you need to do is the insert it in your components array inside the config/main.php file

the most important array key is the "class" which it value will be the path to the auth.php file




     components=>array(

         .............

      'Auth' =>array (

                  'class'=>'..//Auth.php'  #put the dir of your extension

                  //you can also define use variables inside this array

  

now in your code (model, controllers) you can have this


 

     Yii::app()->Auth



Awesome, thanks for the helpful reply.

Did you ever make it anywhere with this one? I’ve been following the HybridAuth library for a while…very interested in hearing what you ended up doing.

Also following this thread here: http://www.yiiframework.com/forum/index.php/topic/31020-hybridauth