Nico Rodsevich
Nico Rodsevich

Reputation: 2575

How to use Facebook php-sdk via FOSFacebookBundle?

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?

Upvotes: 0

Views: 323

Answers (1)

LBridge
LBridge

Reputation: 2135

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();

Upvotes: 1

Related Questions