joelbutcher/laravel-facebook-graph

Laravel wrapper for the Facebook Graph SDK for PHP 7.4 and PHP 8.

v1.3.0 2024-02-28 09:32 UTC

This package is auto-updated.

Last update: 2024-12-09 09:50:45 UTC


README

Build Status Total Downloads Latest Stable Version License

Installation

Getting started with Laravel Facebook Graph is easy - first, install the package via composer

composer require joelbutcher/laravel-facebook-graph

Then publish the package config:

php artisan vendor:publish --provider="JoelButcher\Facebook\FacebookServiceProvider"

This will add a config/facebook.php file to your project. Here you may configure the following options:

URL Detection Handler

You may add a custom URL Detection handler, by binding a singleton your implementation in the register method of the AppServiceProvider:

$this->app->singleton(UrlDetectionInterface::class, fn ($app) => $app[UrlDetectionHandler::class])

Persistent Data Handlers

In order to store the state for OAuth requests to Facebook, you will either need to register a persistent data handler. You can find an example of how to do this here

HTTP Client

The current version of the Facebook Graph SDK (v6) uses HTTPlug for making requests. If you wish to use your own HTTP Client, it MUST implment the Http\Client\HttpClient interface. Please refer to this example