Search code examples
facebookcomposer-phpkohanakohana-3

How to use the composer in kohana 3.3?


Trying to connect the package: https://packagist.org/packages/facebook/php-sdk-v4

Doing so: php composer.phar require facebook / php-sdk-v4

There is a successful installation package

composer.json:

{
    "require": {
        "phpunit/phpunit": "3.7.24",
        "phing/phing": "dev-master",
        "facebook/php-sdk-v4": "4.1.*@dev"
    }
}

The file butstrap.fp before loading module adds:

require (DOCROOT.'vendor / autoload.php ');

In the right controller call:

FacebookSession :: setDefaultApplication ('APP_ID', 'APP_SECRET'); and I get the error:

ErrorException [ Fatal Error ]: Class 'FacebookSession' not found

Why is that?

Tried to run

$ session = new FacebookSession (); , An error occurs:

ErrorException [ Fatal Error ]: Class 'FacebookSession' not found


Solution

  • The Facebook SDK uses namespaces, and you are not using them. That's why the classes are not found: You have to add the namespace or import the class into your own namespace.