PHPackages                             thomaswelton/facebook-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. thomaswelton/facebook-php-sdk

ActiveLibrary[API Development](/categories/api)

thomaswelton/facebook-php-sdk
=============================

Facebook PHP SDK

3.2.4(9y ago)131.0k2Apache2PHPPHP &gt;=5.2.0

Since Aug 14Pushed 9y ago1 watchersCompare

[ Source](https://github.com/thomaswelton/facebook-php-sdk)[ Packagist](https://packagist.org/packages/thomaswelton/facebook-php-sdk)[ Docs](https://github.com/thomaswelton/facebook-php-sdk)[ RSS](/packages/thomaswelton-facebook-php-sdk/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (1)Versions (6)Used By (0)

[![Total Downloads](https://camo.githubusercontent.com/198afb85d3096e1ee5b23d0f1f6762f3b6a9f783fefad301fee77b50c1464823/68747470733a2f2f706f7365722e707567782e6f72672f74686f6d617377656c746f6e2f66616365626f6f6b2d7068702d73646b2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/thomaswelton/facebook-php-sdk)

Facebook PHP SDK (v.3.2.3)

The [Facebook Platform](http://developers.facebook.com/) is a set of APIs that make your app more social.

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 ().

Usage
-----

[](#usage)

The [examples](/examples/example.php) are a good place to start. The minimal you'll need to have is:

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

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

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

To make [API](http://developers.facebook.com/docs/api) calls:

```
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`:

```
$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.

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

Tests
-----

[](#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.

The tests can be executed by using this command from the base directory:

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

```

Contributing
============

[](#contributing)

For us to accept contributions you will have to first have signed the [Contributor License Agreement](https://developers.facebook.com/opensource/cla).

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

Before creating a pull request, squash your commits into a single commit.

Add the comments where needed, and provide ample explanation in the commit message.

Report Issues/Bugs
==================

[](#report-issuesbugs)

[Bugs](https://developers.facebook.com/bugs)

[Questions](http://facebook.stackoverflow.com)

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~419 days

Total

5

Last Release

3388d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/678372?v=4)[Thomas Welton](/maintainers/thomaswelton)[@thomaswelton](https://github.com/thomaswelton)

---

Top Contributors

[![daaku](https://avatars.githubusercontent.com/u/593?v=4)](https://github.com/daaku "daaku (88 commits)")[![ptarjan](https://avatars.githubusercontent.com/u/40143?v=4)](https://github.com/ptarjan "ptarjan (24 commits)")[![gfosco](https://avatars.githubusercontent.com/u/406732?v=4)](https://github.com/gfosco "gfosco (18 commits)")[![oyvindkinsey](https://avatars.githubusercontent.com/u/108034?v=4)](https://github.com/oyvindkinsey "oyvindkinsey (13 commits)")[![moisadoru](https://avatars.githubusercontent.com/u/109328?v=4)](https://github.com/moisadoru "moisadoru (8 commits)")[![thomaswelton](https://avatars.githubusercontent.com/u/678372?v=4)](https://github.com/thomaswelton "thomaswelton (6 commits)")[![jimmykane](https://avatars.githubusercontent.com/u/1268723?v=4)](https://github.com/jimmykane "jimmykane (5 commits)")[![catclee](https://avatars.githubusercontent.com/u/146499?v=4)](https://github.com/catclee "catclee (5 commits)")[![scottmac](https://avatars.githubusercontent.com/u/50088?v=4)](https://github.com/scottmac "scottmac (4 commits)")[![liuggio](https://avatars.githubusercontent.com/u/530406?v=4)](https://github.com/liuggio "liuggio (3 commits)")[![agiuliano](https://avatars.githubusercontent.com/u/1260243?v=4)](https://github.com/agiuliano "agiuliano (3 commits)")[![mattwkelly](https://avatars.githubusercontent.com/u/174449?v=4)](https://github.com/mattwkelly "mattwkelly (3 commits)")[![techdubb](https://avatars.githubusercontent.com/u/181554?v=4)](https://github.com/techdubb "techdubb (2 commits)")[![JuhQ](https://avatars.githubusercontent.com/u/525676?v=4)](https://github.com/JuhQ "JuhQ (2 commits)")[![codler](https://avatars.githubusercontent.com/u/102052?v=4)](https://github.com/codler "codler (2 commits)")[![irazasyed](https://avatars.githubusercontent.com/u/1915268?v=4)](https://github.com/irazasyed "irazasyed (2 commits)")[![mattynoce](https://avatars.githubusercontent.com/u/938638?v=4)](https://github.com/mattynoce "mattynoce (2 commits)")[![gary-rafferty](https://avatars.githubusercontent.com/u/74409?v=4)](https://github.com/gary-rafferty "gary-rafferty (2 commits)")[![yandod](https://avatars.githubusercontent.com/u/103903?v=4)](https://github.com/yandod "yandod (1 commits)")[![alixandru](https://avatars.githubusercontent.com/u/155061?v=4)](https://github.com/alixandru "alixandru (1 commits)")

---

Tags

sdkfacebook

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thomaswelton-facebook-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/thomaswelton-facebook-php-sdk/health.svg)](https://phpackages.com/packages/thomaswelton-facebook-php-sdk)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
