0

I want to use the Facebook's PHP-SDK in a Symfony2 project to send notifications. How is the best way to get the PHP-SDK in a controller?

Emii Khaos
  • 9,983
  • 3
  • 34
  • 57
Nico Rodsevich
  • 2,393
  • 2
  • 22
  • 32

1 Answers1

1

Having FOSFacebookBundle installed and configured, you can get the PHP SDK inside a controller like this:

$facebook = $this->container->get('fos_facebook.api');

The following would get the Facebook user id if logged in for instance:

$uid = $facebook->getUser();
LBridge
  • 2,135
  • 5
  • 21
  • 32