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

ActiveLibrary

francimedia/facebook-php-sdk-v4
===============================

Facebook SDK for PHP

5.1.2(10y ago)040Facebook PlatformPHPPHP &gt;=5.4.0

Since Apr 28Pushed 10y ago1 watchersCompare

[ Source](https://github.com/francimedia/facebook-php-sdk-v4)[ Packagist](https://packagist.org/packages/francimedia/facebook-php-sdk-v4)[ Docs](https://github.com/facebook/facebook-php-sdk-v4)[ RSS](/packages/francimedia-facebook-php-sdk-v4/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (31)Used By (0)

Facebook SDK for PHP (v5)
=========================

[](#facebook-sdk-for-php-v5)

[![Build Status](https://camo.githubusercontent.com/6026fffb344a45aad37fcd9a6705730d690ab2adbeee41508c045c5ce4c7cbd5/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f66616365626f6f6b2f66616365626f6f6b2d7068702d73646b2d76342f6d61737465722e737667)](https://travis-ci.org/facebook/facebook-php-sdk-v4)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/67399862edb98f03b88a5bd30cea8956e2000b6886219fe28f6a65322f0de292/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f66616365626f6f6b2f66616365626f6f6b2d7068702d73646b2d76342f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/facebook/facebook-php-sdk-v4/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/2e6949e7d41946e8e8913a2322393a9f7a5dae256366b56eb4f5faf8be0e6b1f/687474703a2f2f696d672e736869656c64732e696f2f62616467652f4c6174657374253230537461626c652d352e312e322d626c75652e737667)](https://packagist.org/packages/facebook/php-sdk-v4)

This repository contains the open source PHP SDK that allows you to access the Facebook Platform from your PHP app.

Installation
------------

[](#installation)

The Facebook PHP SDK can be installed with [Composer](https://getcomposer.org/). Run this command:

```
composer require facebook/php-sdk-v4
```

Upgrading to v5.x
-----------------

[](#upgrading-to-v5x)

Upgrading from v4.x? Facebook PHP SDK v5.x introduced breaking changes. Please [read the upgrade guide](https://www.sammyk.me/upgrading-the-facebook-php-sdk-from-v4-to-v5) before upgrading.

Usage
-----

[](#usage)

> **Note:** This version of the Facebook SDK for PHP requires PHP 5.4 or greater.

Simple GET example of a user's profile.

```
$fb = new Facebook\Facebook([
  'app_id' => '{app-id}',
  'app_secret' => '{app-secret}',
  'default_graph_version' => 'v2.5',
  //'default_access_token' => '{access-token}', // optional
]);

// Use one of the helper classes to get a Facebook\Authentication\AccessToken entity.
//   $helper = $fb->getRedirectLoginHelper();
//   $helper = $fb->getJavaScriptHelper();
//   $helper = $fb->getCanvasHelper();
//   $helper = $fb->getPageTabHelper();

try {
  // Get the Facebook\GraphNodes\GraphUser object for the current user.
  // If you provided a 'default_access_token', the '{access-token}' is optional.
  $response = $fb->get('/me', '{access-token}');
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  // When Graph returns an error
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  // When validation fails or other local issues
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}

$me = $response->getGraphUser();
echo 'Logged in as ' . $me->getName();
```

Complete documentation, installation instructions, and examples are available at:

Tests
-----

[](#tests)

1. [Composer](https://getcomposer.org/) is a prerequisite for running the tests. Install composer globally, then run `composer install` to install required files.
2. Create a test app on [Facebook Developers](https://developers.facebook.com), then create `tests/FacebookTestCredentials.php` from `tests/FacebookTestCredentials.php.dist` and edit it to add your credentials.
3. The tests can be executed by running this command from the root directory:

```
$ ./vendor/bin/phpunit
```

By default the tests will send live HTTP requests to the Graph API. If you are without an internet connection you can skip these tests by excluding the `integration` group.

```
$ ./vendor/bin/phpunit --exclude-group integration
```

Contributing
------------

[](#contributing)

For us to accept contributions you will have to first have signed the [Contributor License Agreement](https://developers.facebook.com/opensource/cla). Please see [CONTRIBUTING](https://github.com/facebook/facebook-php-sdk-v4/blob/master/CONTRIBUTING.md) for details.

License
-------

[](#license)

Please see the [license file](https://github.com/facebook/facebook-php-sdk-v4/blob/master/LICENSE) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity69

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

Recently: every ~57 days

Total

28

Last Release

3825d ago

Major Versions

4.0.23 → 5.0.02015-07-08

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ac6034f39604db841841b8915fa4b954e76bb8f3145969e815a37fa2022802f?d=identicon)[francimedia](/maintainers/francimedia)

---

Top Contributors

[![SammyK](https://avatars.githubusercontent.com/u/578780?v=4)](https://github.com/SammyK "SammyK (120 commits)")[![gfosco](https://avatars.githubusercontent.com/u/406732?v=4)](https://github.com/gfosco "gfosco (103 commits)")[![yguedidi](https://avatars.githubusercontent.com/u/1480128?v=4)](https://github.com/yguedidi "yguedidi (32 commits)")[![EmanueleMinotto](https://avatars.githubusercontent.com/u/417201?v=4)](https://github.com/EmanueleMinotto "EmanueleMinotto (13 commits)")[![tlshaheen](https://avatars.githubusercontent.com/u/385724?v=4)](https://github.com/tlshaheen "tlshaheen (6 commits)")[![danielegrosso](https://avatars.githubusercontent.com/u/5718544?v=4)](https://github.com/danielegrosso "danielegrosso (5 commits)")[![hardik-bhadani-git](https://avatars.githubusercontent.com/u/6279697?v=4)](https://github.com/hardik-bhadani-git "hardik-bhadani-git (4 commits)")[![alex-orbit](https://avatars.githubusercontent.com/u/192304739?v=4)](https://github.com/alex-orbit "alex-orbit (3 commits)")[![keyvanakbary](https://avatars.githubusercontent.com/u/717129?v=4)](https://github.com/keyvanakbary "keyvanakbary (3 commits)")[![rpalladino](https://avatars.githubusercontent.com/u/1429151?v=4)](https://github.com/rpalladino "rpalladino (3 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (3 commits)")[![rdohms](https://avatars.githubusercontent.com/u/94331?v=4)](https://github.com/rdohms "rdohms (3 commits)")[![guidolodetti](https://avatars.githubusercontent.com/u/7063023?v=4)](https://github.com/guidolodetti "guidolodetti (3 commits)")[![aleksey-kozakov](https://avatars.githubusercontent.com/u/565530?v=4)](https://github.com/aleksey-kozakov "aleksey-kozakov (2 commits)")[![arturluizbr](https://avatars.githubusercontent.com/u/3036919?v=4)](https://github.com/arturluizbr "arturluizbr (2 commits)")[![bartekn](https://avatars.githubusercontent.com/u/464938?v=4)](https://github.com/bartekn "bartekn (2 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (2 commits)")[![niraj-shah](https://avatars.githubusercontent.com/u/690705?v=4)](https://github.com/niraj-shah "niraj-shah (2 commits)")[![rajbdilip](https://avatars.githubusercontent.com/u/5624277?v=4)](https://github.com/rajbdilip "rajbdilip (2 commits)")[![sarciszewski](https://avatars.githubusercontent.com/u/3710836?v=4)](https://github.com/sarciszewski "sarciszewski (2 commits)")

---

Tags

sdkfacebook

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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