martinbean / laravel-facebook-data-handler by martinbean

Persistent data handler for Facebook Graph SDK that uses Laravel sessions.
11
1
2
Package Data
Maintainer Username: martinbean
Maintainer Contact: martin@martinbean.co.uk (Martin Bean)
Package Create Date: 2017-04-12
Package Last Update: 2017-04-12
Language: PHP
License: MIT
Last Refreshed: 2024-11-15 15:13:15
Package Statistics
Total Downloads: 11
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Laravel Session Persistent Data Handler for Facebook SDK for PHP

Installation

$ composer require martinbean/laravel-facebook-data-handler

Usage

Prerequisites

You need to specify your Facebook app ID and secret to use the SDK.

First, add the following to your .env file:

FACEBOOK_CLIENT_ID=your-client-id
FACEBOOK_CLIENT_SECRET=your-client-secret

Then, add the following section to your config/services.php file:

'facebook' => [
    'client_id' => env('FACEBOOK_CLIENT_ID'),
    'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
],

Using the SDK

The Facebook SDK and persistent data handler are wrapped up in a service provider that you can drop in to your Laravel 5 applications. Simply add the following to the providers array in your config/app.php file:

MartinBean\Facebook\Providers\FacebookServiceProvider::class,

Now, whenever you type-hint Facebook\Facebook in your application, you’ll get the Facebook SDK pre-configured with your app ID, secret, and the persistent data handler contained in this package.

For example:

<?php

namespace App\Http\Controllers;

use Facebook\Facebook;

class FacebookLoginController extends Controller
{
    protected $facebook;

    public function __construct(Facebook $facebook)
    {
        $this->facebook = $facebook;
    }
}

License

Licensed under the MIT License.

Issues

Please open a GitHub Issue.