CakePHP 2.x session handler for Facebook php-graph-sdk

1.4.1 2018-02-28 18:46 UTC

This package is not auto-updated.

Last update: 2022-01-08 15:18:16 UTC


Latest Stable Version Latest Unstable Version Scrutinizer Code Quality Code Coverage License

CakePHP 2.x session handler for Facebook php-graph-sdk.

Let Facebook php-graph-sdk use CakeSession for session access.


composer require wrdx/dev-facebook-cake-session-persistent-data-handler


$fb = new \Facebook\Facebook([
  'app_id' => '{app-id}',
  'app_secret' => '{app-secret}',
  'default_graph_version' => '{default-graph-version}',
  'persistent_data_handler' => new \WrDX\Facebook\FacebookCakeSessionPersistentDataHandler($this->Session),

Make sure your CakePHP installation uses the Composer autoloader. In your Config/bootstrap.php file add the following:

# Load Composer autoload.
require APP . 'Vendor/autoload.php';

# Remove and re-prepend CakePHP's autoloader as Composer thinks it is the most important.
# See: http://goo.gl/kKVJO7
spl_autoload_unregister(array('App', 'load'));
spl_autoload_register(array('App', 'load'), true, true);

See https://book.cakephp.org/2.0/en/installation/advanced-installation.html for more information about CakePHP 2 and composer.