Skip to content

Instantly share code, notes, and snippets.

@YOzaz
Created October 13, 2015 13:40
Show Gist options
  • Save YOzaz/b33814436e9b02a5f907 to your computer and use it in GitHub Desktop.
Save YOzaz/b33814436e9b02a5f907 to your computer and use it in GitHub Desktop.
Facebook Repository with Session auto-start
<?php namespace MyApp\Utils;
use Facebook\Facebook;
use MyApp\Support\Memory\SessionManager;
/**
* @class FacebookRepository Our repository, containing commonly used queries
*/
class FacebookRepository
{
use SessionManager;
/** @var Facebook */
protected $fb;
public function __construct()
{
$this->startSession();
$this->fb = new Facebook([
'app_id' => $_ENV['facebook.app_id'],
'app_secret' => $_ENV['facebook.app_secret'],
'default_graph_version' => $_ENV['facebook.version'],
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment