PHPackages                             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. facebook/php-sdk

Abandoned → [facebook/graph-sdk](/?search=facebook%2Fgraph-sdk)ArchivedLibrary[API Development](/categories/api)

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

Facebook PHP SDK

v3.2.3(12y ago)3.3k2.2M—0.5%2.8k[1 issues](https://github.com/facebookarchive/facebook-php-sdk/issues)[1 PRs](https://github.com/facebookarchive/facebook-php-sdk/pulls)20Apache2PHPPHP &gt;=5.2.0

Since Aug 14Pushed 7y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (5)Used By (20)

### New SDK Released

[](#new-sdk-released)

We've released version 4 of the Facebook SDK for PHP here: Please use the new repository for new projects and contributions. See the [Facebook Developers](https://developers.facebook.com/docs/php/) site for documentation.

---

---

---

---

Facebook PHP SDK (v.3.2.3) (DEPRECATED)

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(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();
}
```

With Composer:

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

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

52

—

FairBetter than 96% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity71

Solid adoption and visibility

Community49

Growing community involvement

Maturity61

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 ~154 days

Total

4

Last Release

4608d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3757713?v=4)[Joel Marcey](/maintainers/JoelMarcey)[@JoelMarcey](https://github.com/JoelMarcey)

![](https://www.gravatar.com/avatar/db55c8981234bc674902ff0ea18cfa43262cde9dddb98afdc3b66380eda72d17?d=identicon)[viv001](/maintainers/viv001)

![](https://www.gravatar.com/avatar/2abe0d3e1f567813f3475e3f5ea24c0039ff8ee6730a4a773cffdaf89e71bc5d?d=identicon)[scottmac](/maintainers/scottmac)

---

Top Contributors

[![daaku](https://avatars.githubusercontent.com/u/593?v=4)](https://github.com/daaku "daaku (89 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 (19 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)")[![catclee](https://avatars.githubusercontent.com/u/146499?v=4)](https://github.com/catclee "catclee (5 commits)")[![jimmykane](https://avatars.githubusercontent.com/u/1268723?v=4)](https://github.com/jimmykane "jimmykane (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)")[![gary-rafferty](https://avatars.githubusercontent.com/u/74409?v=4)](https://github.com/gary-rafferty "gary-rafferty (2 commits)")[![mattynoce](https://avatars.githubusercontent.com/u/938638?v=4)](https://github.com/mattynoce "mattynoce (2 commits)")[![ollea](https://avatars.githubusercontent.com/u/4981939?v=4)](https://github.com/ollea "ollea (2 commits)")[![techdubb](https://avatars.githubusercontent.com/u/181554?v=4)](https://github.com/techdubb "techdubb (2 commits)")[![irazasyed](https://avatars.githubusercontent.com/u/1915268?v=4)](https://github.com/irazasyed "irazasyed (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)")[![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/facebook-php-sdk/health.svg)

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

PHPackages © 2026

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