I created an application using cakephp auth component in cakephp 2.6.2 version, now I also implement a login with facebook using facebook sdk, I am trying to follow this post How do I integrate Facebook SDK login with cakephp 2.x?, and for this I have downloaded the facebook-php-sdk-v4, however when I use the sentence
App::import('Vendor', 'facebook-php-sdk-v4-5.0-dev/src/Facebook');
and then call the Facebook class, I am having the error
Fatal error: Class 'Facebook' not found in C:\xampp\htdocs\exampleApp\app\Controller\AppController.php on line 34
I copied facebook SDK in exampleApp\app\Vendor and the folder is named facebook-php-sdk-v4-5.0-dev
my appControll here
<?php
App::uses('Controller', 'Controller');
App::import('Vendor', 'facebook-php-sdk-v4-5.0-dev/src/Facebook');
class AppController extends Controller {
public $components = array(
'Session',
'Auth' => array(
'loginRedirect' => array(
'controller' => 'home',
'action' => 'Page'
),
'logoutRedirect' => array(
'controller' => 'users',
'action' => 'login'
),
'authenticate' => array(
'Form' => array(
'passwordHasher' => 'Blowfish'
)
),
'authorize' => array('Controller'),
'authError' => false
)
);
public function beforeFilter(){
$this->Facebook = new Facebook(array(
'appId' => 'App_ID_of_facebook',
'secret' => 'App_Secret'
));
$this->layout = 'bootstrap';
$this->Auth->allow(
'login',
'logout'
);
$this->set('current_user', $this->Auth->user());
}
public function isAuthorized($user)
{
if(isset($user['role_id']) && $user['role_id'] === '1')
{
return true;
}
return false;
}
}
?>
The problem is particularly in
$this->Facebook = new Facebook(array(
'appId' => 'App_ID_of_facebook',
'secret' => 'App_Secret'
));
is here where is returning Fatal error: Class 'Facebook' not found
thank you very much in advance to anyone who can help me