joelbutcher / laravel-facebook-graph
Laravel wrapper for the Facebook Graph SDK for PHP 7.4 and PHP 8.
Fund package maintenance!
joelbutcher
paypal.me/joelbutcher
Installs: 93 063
Dependents: 0
Suggesters: 0
Security: 0
Stars: 69
Watchers: 8
Forks: 12
Open Issues: 1
Requires
- php: ^7.3|^8.0
- illuminate/support: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- joelbutcher/facebook-graph-sdk: ^6.0.0
- symfony/http-client: ^5.3|^6.0
Requires (Dev)
- mockery/mockery: ^1.4.2
- orchestra/testbench: ^6.0|^7.0|^9.0
- pestphp/pest: ^1.21|^2.34
- phpunit/phpunit: ^9.4|^10.5
README
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