PHPackages                             slivka-b/php-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. slivka-b/php-graph-sdk

ActiveLibrary[API Development](/categories/api)

slivka-b/php-graph-sdk
======================

Facebook SDK for PHP

5.0.1(3y ago)086Facebook PlatformPHPPHP ^8.1

Since Mar 22Pushed 3y agoCompare

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

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

Facebook SDK for PHP (v6)
=========================

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

[![Latest Version](https://camo.githubusercontent.com/3d1e61271b43bff2e5e45aac2f9bb943caa54fbe8f0e13e53380c177afe0afd3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f727573616b6f7676762f7068702d67726170682d73646b2e7376673f7374796c653d666c61742d737175617265)](https://github.com/rusakovvv/php-graph-sdk/releases)[![Build Status](https://camo.githubusercontent.com/8acb83c9d3db3ff9208f751e4be4a9c0b9bdfa093524cfb8bff1ed8566a5eebe/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f727573616b6f7676762f7068702d67726170682d73646b2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/rusakovvv/php-graph-sdk)[![Code Coverage](https://camo.githubusercontent.com/76699a215d4e556f3ef5e5f6b0722da16e38c4c9a86a34f113aa7a5c920cdcab/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f727573616b6f7676762f7068702d67726170682d73646b2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/rusakovvv/php-graph-sdk)[![Quality Score](https://camo.githubusercontent.com/36c310b7e634bc17301642d882b24481a422983b193ef1f9c159dbce507b7e04/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f727573616b6f7676762f7068702d67726170682d73646b2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/rusakovvv/php-graph-sdk)[![Total Downloads](https://camo.githubusercontent.com/7d96b815437877af9f612162c11fb838004c6153d52658ad73b067bf389f4113/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f727573616b6f7676762f7068702d67726170682d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rusakovvv/php-graph-sdk)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 rusakovvv/php-graph-sdk
```

Please be aware, that there are issues when using the Facebook SDK together with [Guzzle](https://github.com/guzzle/guzzle) 6.x. php-graph-sdk v5.x only works with Guzzle 5.x out of the box. However, [there is a workaround to make it work with Guzzle 6.x](https://www.sammyk.me/how-to-inject-your-own-http-client-in-the-facebook-php-sdk-v5#writing-a-guzzle-6-http-client-implementation-from-scratch).

Usage
-----

[](#usage)

> **Note:** This version of the Facebook SDK for PHP requires PHP 8 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 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();
```

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

License
-------

[](#license)

Please see the [license file](https://github.com/facebook/php-graph-sdk/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

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

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

Total

2

Last Release

1145d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/593a292c66ea42e04d10ede2b2706869fea2df13f7ac3dc766c83e26a7699fec?d=identicon)[SviatoslavBereznitskyi](/maintainers/SviatoslavBereznitskyi)

---

Top Contributors

[![SammyK](https://avatars.githubusercontent.com/u/578780?v=4)](https://github.com/SammyK "SammyK (217 commits)")[![gfosco](https://avatars.githubusercontent.com/u/406732?v=4)](https://github.com/gfosco "gfosco (109 commits)")[![yguedidi](https://avatars.githubusercontent.com/u/1480128?v=4)](https://github.com/yguedidi "yguedidi (60 commits)")[![EmanueleMinotto](https://avatars.githubusercontent.com/u/417201?v=4)](https://github.com/EmanueleMinotto "EmanueleMinotto (14 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (13 commits)")[![teldosas](https://avatars.githubusercontent.com/u/10049633?v=4)](https://github.com/teldosas "teldosas (10 commits)")[![martinstuecklschwaiger](https://avatars.githubusercontent.com/u/1061218?v=4)](https://github.com/martinstuecklschwaiger "martinstuecklschwaiger (8 commits)")[![tlshaheen](https://avatars.githubusercontent.com/u/385724?v=4)](https://github.com/tlshaheen "tlshaheen (6 commits)")[![rusakovvv](https://avatars.githubusercontent.com/u/17797557?v=4)](https://github.com/rusakovvv "rusakovvv (6 commits)")[![danielegrosso](https://avatars.githubusercontent.com/u/5718544?v=4)](https://github.com/danielegrosso "danielegrosso (5 commits)")[![tolbon](https://avatars.githubusercontent.com/u/768394?v=4)](https://github.com/tolbon "tolbon (5 commits)")[![hardik-bhadani-git](https://avatars.githubusercontent.com/u/6279697?v=4)](https://github.com/hardik-bhadani-git "hardik-bhadani-git (4 commits)")[![phaizullin](https://avatars.githubusercontent.com/u/884354?v=4)](https://github.com/phaizullin "phaizullin (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)")[![qpautrat](https://avatars.githubusercontent.com/u/1844413?v=4)](https://github.com/qpautrat "qpautrat (3 commits)")[![rdohms](https://avatars.githubusercontent.com/u/94331?v=4)](https://github.com/rdohms "rdohms (3 commits)")[![rpalladino](https://avatars.githubusercontent.com/u/1429151?v=4)](https://github.com/rpalladino "rpalladino (3 commits)")[![ryanml](https://avatars.githubusercontent.com/u/8732757?v=4)](https://github.com/ryanml "ryanml (3 commits)")

---

Tags

sdkfacebook

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/slivka-b-php-graph-sdk/health.svg)

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

###  Alternatives

[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[facebook/php-ads-sdk

PHP SDK for Facebook Business

9014.1M8](/packages/facebook-php-ads-sdk)[openai-php/laravel

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

3.7k7.6M74](/packages/openai-php-laravel)[joelbutcher/facebook-graph-sdk

Facebook SDK for PHP

42728.5k1](/packages/joelbutcher-facebook-graph-sdk)

PHPackages © 2026

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