Code Monkey home page Code Monkey logo

extended-facebook-php-sdk's Introduction

Extended Facebook PHP SDK (v1.0.0)

The official Facebook PHP SDK is evolving with the platform. This Extended Facebook PHP SDK is what the name suggests. It simply extends the official SDK and includes common functionality such as a basic me and batch requests calls.

It also has a dynamic function overloading for underscore and CamelCase naming convention for function names. If you like underscore naming convention like Kohana it is probably the SDK you should be using.

###Usage### To create an instance:

require "<path to sdk>/core.php"

$facebook = new Facebook_API(array(
        'app_id'  => 'YOUR_APP_ID',
        'secret' => 'YOUR_APP_SECRET',
));

Take look at the Config section for more advanced configuration functionality.

me():

$me = $facebook->me();

Batch request:

$batch_data = array(
    array(
            "method"=> "GET",
            "relative_url"=> "me" // get user info
    ),
    
    array(
            "method"=> "GET",
            "relative_url"=> "me/friends" // get user friends
    ),
    
    array(
            "method"=> "GET",
            "relative_url"=> "me/feed/?limit=100" // get 100 feed entries
    ),
);		

// this method returns JSON decoded data
$results = $this->facebook->api_batch($batch_data);

// result order is determined by batch_data array  
$me = $results[0];
$friends = $results[1]['data'];
$feeds = $results[2]['data'];

###Config### A Facebook application may require a complicated configuration setting like the following.

$config = array(
    'app_id'                    =>'YOUR_APP_ID',
    'secret'                    =>'YOUR_APP_SECRET',
    'file_upload'               => false,
    'app_namespace'             => 'myapp',
    'page_path'                 => '',
    'page_url'                  => '',
    'page_id'                   => '',	
    'permissions'               => array('email', 'user_photos', 'friends_photos', 'read_stream', 'user_birthday', 'friends_birthday'),
    'ignore_ssl_verification'   => true,
    'cookie'                    => true,
    // use the following numbers(in minutes) to cache Facebook data. The application is going to update record after the chatted limit has reached
    'cache_threshold'           => (array(
                                    'me'        => 721,
                                    'friends'   => 721,
                                    'feed'      => 721,
    )),
);

To get a config value it does not require to write a new method. The class can return any config value. The trick is to call config_<config_name>, if theres is a config variable by that name, this will return the value.

Get app_namespace:

$app_namespace = $facebook->config_app_namespace();

extended-facebook-php-sdk's People

Contributors

mmohiudd avatar eldar-ca avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.