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

ActiveLibrary[API Development](/categories/api)

palpalani/facebook-graph-sdk
============================

Facebook SDK for PHP

v6.0.9(1y ago)07.9kMITPHPPHP ^7.3 || ^8.0

Since Apr 28Pushed 1y agoCompare

[ Source](https://github.com/palpalani/facebook-php-graph-sdk)[ Packagist](https://packagist.org/packages/palpalani/facebook-graph-sdk)[ Docs](https://github.com/palpalani/facebook-php-graph-sdk)[ Fund](https://paypal.me/joelbutcher)[ GitHub Sponsors](https://github.com/joelbutcher)[ RSS](/packages/palpalani-facebook-graph-sdk/feed)WikiDiscussions 6.x Synced 1mo ago

READMEChangelog (9)Dependencies (10)Versions (65)Used By (0)

Facebook Graph PHP SDK
======================

[](#facebook-graph-php-sdk)

This repository contains the open source PHP SDK that allows you to access the Facebook Platform from your PHP app. It is modified to allow compatibility, view the previous SDK version [here](https://github.com/facebookarchive/php-graph-sdk)

 [ ![Build Status](https://github.com/joelbutcher/facebook-php-graph-sdk/workflows/tests/badge.svg) ](https://github.com/joelbutcher/facebook-php-graph-sdk/actions) [ ![Total Downloads](https://camo.githubusercontent.com/c20b586fb4a2f84017040b312fe72c1eebcfac256bbc25823140929fdd8127be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6f656c627574636865722f66616365626f6f6b2d67726170682d73646b) ](https://packagist.org/packages/joelbutcher/facebook-graph-sdk) [ ![Latest Stable Version](https://camo.githubusercontent.com/c5d5a97df1d916e9277afa1dcae1bd4b5c07d78bde2ad404ce11f433bd843e41/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6f656c627574636865722f66616365626f6f6b2d67726170682d73646b) ](https://packagist.org/packages/joelbutcher/facebook-graph-sdk) [ ![License](https://camo.githubusercontent.com/00e7b8fa10cd2ac0b488d150e0b365a9f0f575d63a707d0d8f9cde2468fe32c6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6a6f656c627574636865722f66616365626f6f6b2d67726170682d73646b) ](https://packagist.org/packages/joelbutcher/facebook-graph-sdk)

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

[](#installation)

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

```
composer require joelbutcher/facebook-graph-sdk
```

Usage
-----

[](#usage)

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

Simple GET example of a user's profile.

```
require_once __DIR__ . '/vendor/autoload.php'; // change path as needed

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

// Use one of the helper classes to get a Facebook\Authentication\AccessToken instance.
//   $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 [here](docs/).

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/joelbutcher/facebook-graph-sdk-php-8/blob/master/CONTRIBUTING.md) for details.

License
-------

[](#license)

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

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you have found a security issue, please contact the maintainers directly at .

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance49

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

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

Recently: every ~169 days

Total

62

Last Release

402d ago

Major Versions

4.0.23 → 5.0.02015-07-08

5.7.0 → 6.0.0-beta12021-07-30

PHP version history (3 changes)v4.0.0PHP &gt;=5.4.0

5.1.5PHP ^5.4|^7.0

6.0.0-beta1PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/716695?v=4)[Palaniappan P](/maintainers/palpalani)[@palpalani](https://github.com/palpalani)

---

Top Contributors

[![SammyK](https://avatars.githubusercontent.com/u/578780?v=4)](https://github.com/SammyK "SammyK (281 commits)")[![yguedidi](https://avatars.githubusercontent.com/u/1480128?v=4)](https://github.com/yguedidi "yguedidi (129 commits)")[![gfosco](https://avatars.githubusercontent.com/u/406732?v=4)](https://github.com/gfosco "gfosco (109 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (25 commits)")[![EmanueleMinotto](https://avatars.githubusercontent.com/u/417201?v=4)](https://github.com/EmanueleMinotto "EmanueleMinotto (14 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (12 commits)")[![teldosas](https://avatars.githubusercontent.com/u/10049633?v=4)](https://github.com/teldosas "teldosas (12 commits)")[![joelbutcher](https://avatars.githubusercontent.com/u/7163152?v=4)](https://github.com/joelbutcher "joelbutcher (11 commits)")[![palpalani](https://avatars.githubusercontent.com/u/716695?v=4)](https://github.com/palpalani "palpalani (11 commits)")[![tlshaheen](https://avatars.githubusercontent.com/u/385724?v=4)](https://github.com/tlshaheen "tlshaheen (6 commits)")[![qpautrat](https://avatars.githubusercontent.com/u/1844413?v=4)](https://github.com/qpautrat "qpautrat (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)")[![ryanml](https://avatars.githubusercontent.com/u/8732757?v=4)](https://github.com/ryanml "ryanml (4 commits)")[![tolbon](https://avatars.githubusercontent.com/u/768394?v=4)](https://github.com/tolbon "tolbon (4 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (3 commits)")[![guidolodetti](https://avatars.githubusercontent.com/u/7063023?v=4)](https://github.com/guidolodetti "guidolodetti (3 commits)")[![keyvanakbary](https://avatars.githubusercontent.com/u/717129?v=4)](https://github.com/keyvanakbary "keyvanakbary (3 commits)")[![alex-orbit](https://avatars.githubusercontent.com/u/192304739?v=4)](https://github.com/alex-orbit "alex-orbit (3 commits)")[![rdohms](https://avatars.githubusercontent.com/u/94331?v=4)](https://github.com/rdohms "rdohms (3 commits)")

---

Tags

phpsdkfacebook

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/palpalani-facebook-graph-sdk/health.svg)

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

###  Alternatives

[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[janu-software/facebook-php-sdk

Alternative toolkit for Facebook Graph API

71684.8k2](/packages/janu-software-facebook-php-sdk)[joelbutcher/facebook-graph-sdk

Facebook SDK for PHP

42728.5k1](/packages/joelbutcher-facebook-graph-sdk)[paddlehq/paddle-php-sdk

Paddle's PHP SDK for Paddle Billing.

53301.7k](/packages/paddlehq-paddle-php-sdk)[mozex/anthropic-php

Anthropic PHP is a supercharged community-maintained PHP API client that allows you to interact with Anthropic API.

46365.1k13](/packages/mozex-anthropic-php)

PHPackages © 2026

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