Yii Framework Forum: Question about creating an extension from an existing library. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Question about creating an extension from an existing library. HybridAuth Rate Topic: -----

#1 User is offline   sbefort 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 04-April 12

Posted 22 April 2012 - 03:09 PM

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.
0

#2 User is offline   binkabir 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 193
  • Joined: 25-July 10
  • Location:Abuja,Nigeria

Posted 22 April 2012 - 04:49 PM

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

0

#3 User is offline   sbefort 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 04-April 12

Posted 22 April 2012 - 07:29 PM

Awesome, thanks for the helpful reply.
0

#4 User is offline   PrplHaz4 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 107
  • Joined: 28-September 09
  • Location:Boston, MA

Posted 26 May 2012 - 06:34 PM

View Postsbefort, on 22 April 2012 - 07:29 PM, said:

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.yiiframew...1020-hybridauth
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users