Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
FB Social + composer
  • I've used this Social package for a couple of projects, and it works pretty fine:


    I'm on FuelPHP 1.6 dev and has been installing packages through composer. I'm thinking, is there a FuelPHP social package (or just Facebook for now) that used composer?
  • I have added the Facebook SDK via composer:


    I guess, what I need to understand is to how it would work inside FuelPHP 1.6? :D

    1. Is it autoloaded?

    2. Where should I place this to auto load the settings:

    $facebook = new Facebook(array(
    'appId' => '1234567890',
    'secret' => 'asdfghjkl',
    ));
  • You can use it as any other class, Composer will take care of the autoloading for you.

    I assume you would create the $facebook object in the controller method where you need it?
  • Thanks Harro.

    I remember you mentioned before in my Monga composer question that I need to create a static class to handle this? I assume that's going to be the same approach?
  • HarroHarro
    Accepted Answer
    You don't have too, it depends on your use case.

    A static interface, with forge() and instance() methods is handy if you need to pass objects around a lot. Instead of doing that, your static class can act as a container for your objects, and you can use the instance() method to access them from anywhere.

    If you don't have that requirement, and only need the object within the scope of a controller or controller method, use normal instantiation, and either use a local variable or a property.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion