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

ActiveLibrary[API Development](/categories/api)

abdulbaquee/facebook-graph-sdk
==============================

A PHP SDK to easily interact with the Facebook Graph API.

v1.0.0(1y ago)1361MITPHPPHP &gt;=7.4

Since Aug 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/abdulbaquee/facebook-graph-sdk)[ Packagist](https://packagist.org/packages/abdulbaquee/facebook-graph-sdk)[ RSS](/packages/abdulbaquee-facebook-graph-sdk/feed)WikiDiscussions main Synced 2w ago

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

Unofficial Facebook Graph SDK
=============================

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

It is a PHP SDK for seamless interaction with the Facebook Graph API. It offers an intuitive interface for accessing user profiles, pages, ads, and more. Perfect for developers, it simplifies authentication, data handling, and API requests, making Facebook integration easy for PHP projects.

Simplified version of Facebook Graph SDK

Version: 1.0.0

Website: [webgrapple.com](http://www.webgrapple.com/)

Author: [abdulbaquee](http://www.twitter.com/abdulbaquee85)

Usage of Unofficial Facebook Graph SDK
======================================

[](#usage-of-unofficial-facebook-graph-sdk)

This application requires the Google My Business API v4.0

1. Installation
===============

[](#1-installation)

First, install the SDK via Composer:

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

```

2. Basic Setup
==============

[](#2-basic-setup)

Start by including the autoload file and initializing the SDK:

```
require 'vendor/autoload.php';

use Facebook\GraphSDK\OAuth;
use Facebook\GraphSDK\BaseClient;

$oauth = new OAuth('your-app-id', 'your-app-secret', 'your-redirect-uri', 'graph-version');

```

3. Authentication
=================

[](#3-authentication)

Redirect the user to Facebook's login page to get an authorization code:

```
$loginUrl = $oauth->getLoginUrl(['email', 'public_profile']);
header('Location: ' . $loginUrl);
exit;

```

After the user authorizes, handle the callback to obtain an access token:

```
if (isset($_GET['code'])) {
    $accessToken = $oauth->getAccessTokenFromCode($_GET['code']);
    echo 'Access Token: ' . $accessToken;
}

```

4. Making API Requests
======================

[](#4-making-api-requests)

Use the BaseClient to make requests to the Facebook Graph API:

```
$client = new BaseClient($accessToken);
$response = $client->get('/me?fields=id,name,email');
$user = $response->getBody();

echo 'ID: ' . $user['id'];
echo 'Name: ' . $user['name'];
echo 'Email: ' . $user['email'];

```

5. Batch Requests
=================

[](#5-batch-requests)

For multiple requests in a single call:

```
$batch = [
    $client->createRequest('GET', '/me?fields=id,name'),
    $client->createRequest('GET', '/me/friends'),
];

$batchResponse = $client->sendBatchRequest($batch);

foreach ($batchResponse->getResponses() as $response) {
    print_r($response->getBody());
}

```

6. Error Handling
=================

[](#6-error-handling)

Handle errors gracefully using exceptions:

```
try {
    $response = $client->get('/me?fields=id,name');
} catch (FacebookSDKException $e) {
    echo 'Error: ' . $e->getMessage();
}

```

Requirements
============

[](#requirements)

To use the Facebook Graph SDK for PHP, ensure your environment meets the following requirements:

1. `PHP Version`: PHP 7.4 or higher
2. `Composer`: Installed for dependency management
3. `cURL` Extension: Enabled in your PHP environment
4. `SSL/TLS`: Enabled for secure API communication
5. `Facebook App`: You must have a Facebook App with a valid App ID and App Secret

Important Links
===============

[](#important-links)

1. Facebook Developer Documentation: \[\]
2. Facebook App Dashboard: \[\]
3. Composer Installation: \[\]
4. PHP cURL Extension: \[\]
5. GitHub Repository: \[\]

###  Health Score

26

—

LowBetter than 40% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

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

Unknown

Total

1

Last Release

722d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2876446?v=4)[Mohd Abdul Baquee Shaikh](/maintainers/abdulbaquee)[@abdulbaquee](https://github.com/abdulbaquee)

---

Top Contributors

[![abdulshaikh85](https://avatars.githubusercontent.com/u/54093017?v=4)](https://github.com/abdulshaikh85 "abdulshaikh85 (3 commits)")[![abdulbaquee](https://avatars.githubusercontent.com/u/2876446?v=4)](https://github.com/abdulbaquee "abdulbaquee (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.3M49](/packages/tencentcloud-tencentcloud-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k832.6k55](/packages/neuron-core-neuron-ai)[files.com/files-php-sdk

Files.com PHP SDK

2482.9k](/packages/filescom-files-php-sdk)[volcengine/volcengine-php-sdk

119.5k](/packages/volcengine-volcengine-php-sdk)

PHPackages © 2026

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