Yii and Facebook SDK V4.0

I am trying to use the new PHP PHP PHP SDK v4.0 graphics with the Yii Framework.

I would like to use a namespace, and the application I'm trying to create is a Facebook page tab.

I can not autostart SDK on facebook

Can anyone help me with a solution?

+4
source share
1 answer

I created a shell class for the SDK in the extensions /FacebookUtility.php

// Include facebook client library
require_once __DIR__ . '/../facebook-php-sdk/src/facebook.php';

class FacebookUtility extends CApplicationComponent
{

   public $apiKey;    
   public $secretKey;
           :
           :
   public function connect() { ... }
}

Then, in my main.php, under the components

'facebook'=>array(
  'class'       =>'FacebookUtility',
  'apiKey'     =>'yourapikey',
  'secretKey'  =>'your secret key',
),

Then during my login.

$objFacebook  = Yii::app()->getComponent('facebook');

// Establish a connection to facebook
$objFacebook->connect();
0
source

All Articles