CodeIgniter Forums
Facebook composer library for login - class not found - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Facebook composer library for login - class not found (/showthread.php?tid=73424)



Facebook composer library for login - class not found - mirel.popescu - 04-23-2019

Hello! 

In CI3 sites that I have, to create a facebook login with PHP SDK, I use the instructions from this page ( https://shareurcodes.com/blog/facebook%20php%20sdk%20v5%20with%20codeigniter ) .

The problem is that in CI4 I get the following error: "Class 'App\Controllers\Facebook\Facebook' not found"
The error is on this line: "$fb = new Facebook\Facebook"

Please help.


RE: Facebook composer library for login - class not found - MGatner - 04-24-2019

Your namespace is looking relative to the current namespace (App\Controllers). Try
new \Facebook\Facebook();


RE: Facebook composer library for login - class not found - mirel.popescu - 04-26-2019

Thanks a lot! It worked with use Facebook\Facebook;. After that i just had to call new Facebook. Previously I called $fb = new Facebook\Facebook which was wrong.