2017 © Pedro Peláez
 

library php-sdk

Facebook PHP SDK

image

facebook/php-sdk

Facebook PHP SDK

  • Tuesday, January 13, 2015
  • by viv001
  • Repository
  • 664 Watchers
  • 3484 Stars
  • 1,619,269 Installations
  • PHP
  • 88 Dependents
  • 1 Suggesters
  • 3231 Forks
  • 1 Open issues
  • 5 Versions
  • 1 % Grown

The README.md

New SDK Released

We've released version 4 of the Facebook SDK for PHP here: https://github.com/facebook/facebook-php-sdk-v4 Please use the new repository for new projects and contributions. See the Facebook Developers site for documentation., (*1)





Facebook PHP SDK (v.3.2.3) (DEPRECATED), (*2)

The Facebook Platform is a set of APIs that make your app more social., (*3)

This repository contains the open source PHP SDK that allows you to access Facebook Platform from your PHP app. Except as otherwise noted, the Facebook PHP SDK is licensed under the Apache Licence, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)., (*4)

Usage

The examples are a good place to start. The minimal you'll need to have is:, (*5)

require 'facebook-php-sdk/src/facebook.php';

$facebook = new Facebook(array(
  'appId'  => 'YOUR_APP_ID',
  'secret' => 'YOUR_APP_SECRET',
));

// Get User ID
$user = $facebook->getUser();

To make API calls:, (*6)

if ($user) {
  try {
    // Proceed knowing you have a logged in user who's authenticated.
    $user_profile = $facebook->api('/me');
  } catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
  }
}

You can make api calls by choosing the HTTP method and setting optional parameters:, (*7)

$facebook->api('/me/feed/', 'post', array(
    'message' => 'I want to display this message on my wall'
));

Login or logout url will be needed depending on current user state., (*8)

if ($user) {
  $logoutUrl = $facebook->getLogoutUrl();
} else {
  $loginUrl = $facebook->getLoginUrl();
}

With Composer:, (*9)

  • Add the "facebook/php-sdk": "@stable" into the require section of your composer.json.
  • Run composer install.
  • The example will look like
if (($loader = require_once __DIR__ . '/vendor/autoload.php') == null)  {
  die('Vendor directory not found, Please run composer install.');
}

$facebook = new Facebook(array(
  'appId'  => 'YOUR_APP_ID',
  'secret' => 'YOUR_APP_SECRET',
));

// Get User ID
$user = $facebook->getUser();

Tests

In order to keep us nimble and allow us to bring you new functionality, without compromising on stability, we have ensured full test coverage of the SDK. We are including this in the open source repository to assure you of our commitment to quality, but also with the hopes that you will contribute back to help keep it stable. The easiest way to do so is to file bugs and include a test case., (*10)

The tests can be executed by using this command from the base directory:, (*11)

phpunit --stderr --bootstrap tests/bootstrap.php tests/tests.php

Contributing

For us to accept contributions you will have to first have signed the Contributor License Agreement., (*12)

When commiting, keep all lines to less than 80 characters, and try to follow the existing style., (*13)

Before creating a pull request, squash your commits into a single commit., (*14)

Add the comments where needed, and provide ample explanation in the commit message., (*15)

Report Issues/Bugs

Bugs, (*16)

Questions, (*17)

The Versions

13/01 2015

dev-master

9999999-dev https://github.com/facebook/facebook-php-sdk

Facebook PHP SDK

  Sources   Download

Apache2

The Requires

  • php >=5.2.0
  • ext-curl *
  • ext-json *

 

The Development Requires

sdk facebook

20/11 2013

v3.2.3

3.2.3.0 https://github.com/facebook/facebook-php-sdk

Facebook PHP SDK

  Sources   Download

Apache2

The Requires

  • php >=5.2.0
  • ext-curl *
  • ext-json *

 

The Development Requires

sdk facebook

15/01 2013

v3.2.2

3.2.2.0 https://github.com/facebook/facebook-php-sdk

Facebook PHP SDK

  Sources   Download

Apache2

The Requires

  • php >=5.2.0
  • ext-curl *
  • ext-json *

 

sdk facebook

27/11 2012

v3.2.1

3.2.1.0 https://github.com/facebook/facebook-php-sdk

Facebook PHP SDK

  Sources   Download

Apache2

The Requires

  • php >=5.2.0
  • ext-curl *
  • ext-json *

 

sdk facebook

14/08 2012

v3.2.0

3.2.0.0 https://github.com/facebook/facebook-php-sdk

Facebook PHP SDK

  Sources   Download

Apache2

The Requires

  • php >=5.2.0
  • ext-curl *
  • ext-json *

 

sdk facebook