PHPackages                             jerry4rahul/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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. jerry4rahul/facebook-graph-sdk

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

jerry4rahul/facebook-graph-sdk
==============================

A modern, comprehensive PHP SDK for the Facebook Graph API with enhanced error handling, pagination support, rate limiting, and extensive API coverage.

2.0.0(8mo ago)015MITPHPPHP &gt;=8.0

Since Aug 15Pushed 8mo agoCompare

[ Source](https://github.com/jerry4rahul/facebook-graph-sdk)[ Packagist](https://packagist.org/packages/jerry4rahul/facebook-graph-sdk)[ Docs](https://github.com/jerry4rahul/facebook-graph-sdk)[ GitHub Sponsors](https://github.com/sponsors/jerry4rahul)[ RSS](/packages/jerry4rahul-facebook-graph-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

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

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

[![Latest Stable Version](https://camo.githubusercontent.com/3ddc420b982fb805e4f362f27afef93dbc02762ed74ab42b00c7cd35794aa7c0/68747470733a2f2f706f7365722e707567782e6f72672f6a6572727934726168756c2f66616365626f6f6b2d67726170682d73646b2f762f737461626c65)](https://packagist.org/packages/jerry4rahul/facebook-graph-sdk)[![Total Downloads](https://camo.githubusercontent.com/5226397a49fb22c32f332bc0192f6cabc148602820f12b2abca2c6207bee647c/68747470733a2f2f706f7365722e707567782e6f72672f6a6572727934726168756c2f66616365626f6f6b2d67726170682d73646b2f646f776e6c6f616473)](https://packagist.org/packages/jerry4rahul/facebook-graph-sdk)[![License](https://camo.githubusercontent.com/dee3428625a69a62b6fcadde32450c6c50da034fd40747cb61d0fb79ecd1f47f/68747470733a2f2f706f7365722e707567782e6f72672f6a6572727934726168756c2f66616365626f6f6b2d67726170682d73646b2f6c6963656e7365)](https://packagist.org/packages/jerry4rahul/facebook-graph-sdk)[![PHP Version Require](https://camo.githubusercontent.com/eca52b5f8a6229aa02d5077e8867fe74c6b2002d9fbd1e3057ca665d788652d4/68747470733a2f2f706f7365722e707567782e6f72672f6a6572727934726168756c2f66616365626f6f6b2d67726170682d73646b2f726571756972652f706870)](https://packagist.org/packages/jerry4rahul/facebook-graph-sdk)[![GitHub stars](https://camo.githubusercontent.com/ded0115349a302baf464573930cd9b38c3c7edbea2d48cdeda055d68fe019e12/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6a6572727934726168756c2f66616365626f6f6b2d67726170682d73646b2e7376673f7374796c653d736f6369616c266c6162656c3d53746172)](https://github.com/jerry4rahul/facebook-graph-sdk)[![GitHub forks](https://camo.githubusercontent.com/652ce26e60262d1262312e1c1d7bb94ff77ec59f89afc52f1556e74177a8cd01/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6a6572727934726168756c2f66616365626f6f6b2d67726170682d73646b2e7376673f7374796c653d736f6369616c266c6162656c3d466f726b)](https://github.com/jerry4rahul/facebook-graph-sdk)

A modern, comprehensive PHP SDK for the Facebook Graph API with enhanced error handling, pagination support, rate limiting, and extensive API coverage. Compatible with Graph API v18.0-v23.0+ and PHP 8.0+.

> **Note**: This SDK supports Facebook Graph API v18.0-v23.0+ and requires PHP 8.0 or higher for optimal performance and type safety.

Features
--------

[](#features)

- **🚀 Complete Graph API Coverage**: Support for posts, pages, comments, reactions, events, groups, albums, photos, videos, stories, and more
- **🛡️ Enhanced Error Handling**: Detailed error codes and messages with custom exception types and retry mechanisms
- **📄 Advanced Pagination**: Automatic cursor-based pagination with field selection and bulk data retrieval
- **✅ Input Validation**: Comprehensive validation for all API parameters with security checks
- **🔒 Type Safety**: Full PHP 8+ type hints, strict typing, and modern PHP features
- **📊 PSR-3 Logging**: Built-in logging support for debugging, monitoring, and audit trails
- **⚡ Rate Limiting**: Automatic rate limit tracking, handling, and usage monitoring
- **📦 Batch Requests**: Support for Facebook's batch API with optimized request handling
- **📱 Story Support**: Upload photo stories and video stories to Facebook pages
- **🔄 Binary Uploads**: Direct binary file uploads with progress tracking
- **🔐 OAuth 2.0**: Complete OAuth flow implementation with token management
- **🎯 Field Selection**: Granular field selection for optimized API responses
- **🔄 Auto Retry**: Intelligent retry mechanism for failed requests
- **📈 Analytics**: Built-in insights and analytics data retrieval

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Quick Start](#quick-start)
- [Usage Examples](#usage-examples)
    - [User Information](#user-information)
    - [Pages Management](#pages-management)
    - [Posts and Content](#posts-and-content)
    - [Story Uploads](#story-uploads)
    - [Comments and Interactions](#comments-and-interactions)
    - [Media Upload](#media-upload)
    - [Events](#events)
    - [Groups](#groups)
    - [Albums and Photos](#albums-and-photos)
    - [Videos](#videos)
    - [Insights and Analytics](#insights-and-analytics)
    - [Batch Requests](#batch-requests)
- [Error Handling](#error-handling)
- [Authentication](#authentication)
- [Configuration](#configuration)
- [Rate Limiting](#rate-limiting)
- [Best Practices](#best-practices)
- [Requirements](#requirements)
- [Contributing](#contributing)
- [License](#license)

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

[](#installation)

### Via Composer (Recommended)

[](#via-composer-recommended)

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

### Via Packagist

[](#via-packagist)

Visit [Packagist](https://packagist.org/packages/jerry4rahul/facebook-graph-sdk) for more installation options.

### Manual Installation

[](#manual-installation)

1. Download the latest release from [GitHub](https://github.com/jerry4rahul/facebook-graph-sdk/releases)
2. Extract the files to your project directory
3. Include the autoloader:

```
require_once 'path/to/facebook-graph-sdk/vendor/autoload.php';
```

Quick Start
-----------

[](#quick-start)

### Basic Setup

[](#basic-setup)

```
