Laravel wrapper for the Facebook Graph PHP 8 SDK

Overview

Laravel Facebook Graph SDK

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:

Option Description
app_id Used to identify your app when requesting a users' access token
app_secret The secret key used to authorize your app with Facebook
redirect_url The destination URL to redirect users to, after authenticating with Facebook
graph_version The graph version to target when making user-authenticated requests to the Facebook Graph API, defaults to v11.0
beta_mode Indicates whether or not to run a beta version of the SDK

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

Comments
  • Facebook permission popup is not working when adding the

    Facebook permission popup is not working when adding the "publish_to_groups", "groups_access_member_info" scopes

    Facebook permission popup is not working when I am adding the "publish_to_groups","groups_access_member_info" scopes (currently using laravel socialite package.)

    For permission popup is working fine for these "pages_show_list","pages_read_engagement","pages_manage_posts","instagram_basic","public_profile","instagram_content_publish". (All permission has been approved by the Facebook).

    Why Facebook permission popup is not working with these "publish_to_groups","groups_access_member_info" scopes?

    opened by hemasharma05 3
  • [1.x] Allow scopes to be defined in config and merge with defaults

    [1.x] Allow scopes to be defined in config and merge with defaults

    This PR adds loads any scopes defined in $this->app['config']->get('facebook.scopes') to JoelButcher\Facebook\Facebook in the FacebookServiceProvider::registerFacebook(). It also updates the HandlesAuthentication trait and updates the building of scopes in the redirect URL with the following:

      $scopes = array_merge($this->config['scopes'] ?? [], [
        'email', 'public_profile',
      ]);
    

    Fixes #8

    opened by joelbutcher 3
  • HandlesAuthentication config scopes

    HandlesAuthentication config scopes

    I saw this reference to $this->config(['scopes']) in HandlesAuthentication.php, https://github.com/joelbutcher/laravel-facebook-graph/blob/18d0eec6111dcf1b7f0742b558746ee5cab67265/src/Traits/HandlesAuthentication.php#L56

    thought i could just add something like

        'scopes' => [
            'email',
            'public_profile',
            'publish_actions',
        ],
    

    to my config/facebook.php and it would work but its never set since the service provider is redeclaring the config array rather than just merging config('facebook') with the other keys

    https://github.com/joelbutcher/laravel-facebook-graph/blob/18d0eec6111dcf1b7f0742b558746ee5cab67265/src/FacebookServiceProvider.php#L120-L131

    opened by dpslwk 2
  • Upload image from own server return

    Upload image from own server return "Missing or invalid image file"

    When i try to upload images by post() func, it return this error with images which have my domain name in url, but worked well with other image urls from internet. Please help me to solve this problem

    opened by haigooner95 1
  • Passing $scopes to Facebook ::redirectUrl() no longer get added to the request url

    Passing $scopes to Facebook ::redirectUrl() no longer get added to the request url

    With the merge of #9 the $scopes parameter is ignored when calling array_merge.

    To fix this, we need to add the array to the merge as the second param.

    opened by joelbutcher 0
  • Documentation broken

    Documentation broken

    Hello, Links are broken in documentation page here https://github.com/joelbutcher/laravel-facebook-graph/tree/1.x/docs. I don't understand how to use this package compared to the not laravel one.

    opened by japafrite 3
Releases(v1.2.2)
  • v1.2.2(Oct 13, 2022)

    What's Changed

    • [1.x] Allow v6 of symphony/http-client by @charlielangridge in https://github.com/joelbutcher/laravel-facebook-graph/pull/14

    New Contributors

    • @charlielangridge made their first contribution in https://github.com/joelbutcher/laravel-facebook-graph/pull/14

    Full Changelog: https://github.com/joelbutcher/laravel-facebook-graph/compare/v1.2.1...v1.2.2

    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(Jun 14, 2022)

    What's Changed

    • [1.x] Fix missing scopes passed to redirectUrl by @joelbutcher in https://github.com/joelbutcher/laravel-facebook-graph/pull/11

    Full Changelog: https://github.com/joelbutcher/laravel-facebook-graph/compare/v1.2.0...v1.2.1

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Jun 14, 2022)

    What's Changed

    • [1.x] Allow scopes to be defined in config and merge with defaults by @joelbutcher in https://github.com/joelbutcher/laravel-facebook-graph/pull/9

    Full Changelog: https://github.com/joelbutcher/laravel-facebook-graph/compare/v1.1.1...v1.2.0

    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Feb 9, 2022)

    What's Changed

    • Add PHP 7.3 Support by @joelbutcher in https://github.com/joelbutcher/laravel-facebook-graph/pull/6

    Full Changelog: https://github.com/joelbutcher/laravel-facebook-graph/compare/v1.1.0...v1.1.1

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Feb 9, 2022)

    What's Changed

    • Laravel 9 Support by @joelbutcher in https://github.com/joelbutcher/laravel-facebook-graph/pull/4

    Full Changelog: https://github.com/joelbutcher/laravel-facebook-graph/compare/v1.0.0...v1.1.0

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Aug 20, 2021)

  • 1.0.0-beta1(Aug 1, 2021)

Owner
Joel Butcher
Full Stack PHP / JavaScript developer, based in Lincoln, England. I work with Laravel, React, Next.js, MySQL and TailwindCSS daily.
Joel Butcher
Facebook GraphQL for Laravel 5. It supports Relay, eloquent models, validation and GraphiQL.

Laravel GraphQL This package is no longuer maintained. Please use rebing/graphql-laravel or other Laravel GraphQL packages Use Facebook GraphQL with L

Folklore Inc. 1.8k Dec 11, 2022
A Laravel package to help integrate Shopware PHP SDK much more easier

Shopware 6 Laravel SDK A Laravel package to help integrate Shopware PHP SDK much more easier Installation Install with Composer composer require sas/s

Shape & Shift 16 Nov 3, 2022
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.

Telegram Bot API - PHP SDK Telegram Bot PHP SDK lets you develop Telegram Bots in PHP easily! Supports Laravel out of the box. Telegram Bot API is an

Irfaq Syed 2.5k Jan 6, 2023
It's a PHP Application to simplify working with Google Sheets SDK for php.

About GoogleSheetsPHP It's a PHP Application to simplify working with Google Sheets SDK for php. Note: i used Slim 3 to construct the application but

Sami Alateya 5 Dec 20, 2022
Laravel SDK for Sentry

Sentry for Laravel Laravel integration for Sentry. Laravel Version Compatibility Laravel <= 4.2.x is supported until 0.8.x Laravel <= 5.7.x on PHP <=

Sentry 1.1k Dec 30, 2022
Official repository of the AWS SDK for PHP (@awsforphp)

AWS SDK for PHP - Version 3 The AWS SDK for PHP makes it easy for developers to access Amazon Web Services in their PHP code, and build robust applica

Amazon Web Services 5.7k Jan 1, 2023
Mailgun's Official SDK for PHP

Mailgun PHP client This is the Mailgun PHP SDK. This SDK contains methods for easily interacting with the Mailgun API. Below are examples to get you s

Mailgun Team 1k Dec 23, 2022
Minter Blockchain PHP SDK

About This is a pure PHP SDK for working with Minter blockchain Installation Minter Api Methods: getBalance getNonce send getAddresses getStatus getVa

Minter 24 Nov 21, 2022
The official PHP SDK for Webmarketer (app.webmarketer.io)

PHP SDK for Webmarketer The official PHP SDK for Webmarketer (app.webmarketer.io). Install To add this package, your project must meet several require

Webmarketer 5 Dec 13, 2021
A PHP SDK for the GlobalSmartOTP API.

GlobalSmartOTP PHP SDK A PHP SDK for the GlobalSmartOTP API. Requirements PHP 7.4 or higher cURL Installation $ git clone [email protected]:GlobalSmartOT

GlobalSmartOTP 4 Oct 2, 2022
Fatture in Cloud SDK (Software Development Kit) for PHP

FattureInCloud PHP SDK Request informations In every request description you will be able to find some additional informations about context, permissi

Fatture in Cloud 25 Dec 5, 2022
Explicador e2Payments PHP SDK

This package seeks to help php developers implement the e2Payments APIs without much hustle. It is based on the REST API whose documentation

Explicador 5 Oct 26, 2022
Official PHP SDK for interacting with the Knock API.

Knock PHP library Documentation See the documentation for PHP usage examples

Knock 4 Dec 16, 2022
OneSignal PHP SDK

OneSignal SDK for PHP developers with fluent API and supports Laravel / Lumen out of the box.

Lawrence Onah 4 Nov 8, 2022
2c2p payment gateway Redirect PHP-SDK

2c2p payment gateway Redirect PHP-SDK

Bilions 2 Oct 1, 2022
可能是基于 hyperf 的最优雅的支付宝、微信支付 SDK 了

当前组件整体处于 beta 阶段 运行环境 php >= 7.3 composer hyperf >= 2.1 安装 composer require yansongda/hyperf-pay:~1.0.0 说明 发布配置文件 php bin/hyperf.php vendor:publish ya

yansongda 44 Dec 8, 2022
SDK for latest version of Telegram bots API

SDK for latest version of Telegram bots API (from April 24, 2020) Using Examples Installing composer require "DiyorbekUz/Telelib: dev-master" Init bot

Diyorbek 2 Sep 5, 2021
API SDK for OpenTrade Commerce API: Taobao, Alibaba, JD, 1688, Aliexpress, Ebay.

OtapiPhpClient Create Client $client = new OtClient($key, $secret, $lang); key (Access Key) secret (Secret for access key) language (2 symbol lang id

OpenTrade Commerce 5 Sep 20, 2022
Universal payments API SDK (UNOFFICIAL QIWI CLIENT)

Qiwi Php Client Especially for ?? Zorra Telecom and ?? Everyone else Привет Attention: At the moment the number of methods is very limited, they will

Ivan Terentev 2 Oct 25, 2022