We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Log in with Facebook classes/namespaces

Hi. I am trying to implement Log in with Facebook button and Facebook SDK. I have installed the SDK with composer, and i have included the composer autoload in bootstrap.

My bootstrap and session controller are here: https://pastebin.com/kxiGFTDD .

Facebook says : If you're using the autoloader as part of Composer, the Facebook namespace will be available for use without adding require statements for all of the files. But still I get errors like Class 'Facebook' not found in index.php and Class 'FacebookSession' not found in SessionController.

I think I am missing something really simple : including classes, namespaces, accessing them wrong way, but I really dont know which of theese and need some help :D



17.0k

I really need some help on this one :( Bump



98.9k

This means you're loading the file from the root of your filesystem, is this ok?

require_once '/../vendor/autoload.php';


16.3k

if your controller use namespace, just add blackslash before classname

        \FacebookSession::setDefaultApplication('xxx', 'xxx');
        $helper = new \FacebookRedirectLoginHelper('index/index');