PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, February 11, 2022

[FIXED] Facebook v4.0 SDK with Codeigniter and Composer

 February 11, 2022     codeigniter, composer-php, facebook, facebook-php-sdk, php     No comments   

Issue

I am updating my app to use the Facebook v4 php sdk and am having issues installing it via composer in codeigniter.

I have been using composer with codeigniter without an issue for some time and am loading my autoload file in my index.php.

When running the code I keep getting the following error

Fatal error: Class 'Facebook\FacebookSession' not found in /var/www/dev/application/controllers/playground.php on line 12

Here is my Controller

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

use Facebook\FacebookSession;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
use Facebook\FacebookRequestException;

class Playground extends MY_Controller {
    public function index() {
       FacebookSession::setDefaultApplication('-removed-','-removed-');
    }
 }

I have no idea why...


Solution

Figured it out and it was my own mistake

The facebook documentation correctly tells you to use the following

"facebook/php-sdk-v4": "4.0.*"

The latest composer package on packagist leads you to download the following

"facebook/php-sdk-v4": "4.1.*@dev"



Answered By - bertmaclin
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing