New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

tayokin/laravel-facebook-accountkit

Laravel Facebook Account Kit SDK (PHP)
1,179 2
Install
composer require tayokin/laravel-facebook-accountkit
Latest Version:v1.0.3
PHP:>=7.1.0
Laravel:5
License:MIT
Last Updated:Apr 8, 2018
Links: GitHub  ·  Packagist
Maintainer: tayokin

Laravel Facebook Account Kit

License

A simple package to make Password-less Login possible in Laravel using Facebook's Account Kit.

Requirements

php 7.1+

Composer

Laravel 5.x

Installation

To use this package in a Laravel Project, install via Composer

$ composer require tayokin/laravel-facebook-accountkit

Register the package to the Service Provider in the config/app.php file:

'providers' => [
    ...
    Tayokin\FacebookAccountKit\FacebookAccountKitServiceProvider::class,
],

'aliases' => [
    ...
    'AccountKit' => Tayokin\FacebookAccountKit\Facades\FacebookAccountKitFacade::class,
],

You can make of some assets provided in this package to speed up your implementation: run

$ php artisan vendor:publish

Usage

Create your app on Facebook following guidelines here.

You can view example here.

Update .env file with credentials from Facebook:

ACCOUNTKIT_APP_ID=XXXXXXXXXXXX
ACCOUNTKIT_APP_SECRET=XXXXXXXXXXXXXXXXXXXXXXXX
ACCOUNTKIT_REDIRECT_URL=<path/to/endpoint>

Define your route in routes/web.php. E.g:

Route::get('/<path/to/endpoint>', 'FacebookAccountKitController@endpoint');

Import the package in your Controller and use it therein. E.g:

use Tayokin\FacebookAccountKit\Facades\FacebookAccountKitFacade;
use Illuminate\Http\Request;

class FacebookAccountKitController extends Controller
{
    ...
    public function endpoint(Request $request)
    {
        $accountData = FacebookAccountKitFacade::getAccountDataByCode($request->get('code'));
        ...
    }
}

The above return an array similar to this:

[▼
  "id" => "1802782826673865"
  "phoneNumber" => "+38093XXXXXXX",
  "email" => ""
]

Views

Ensure your form has csrf_token, E.g:

<input type="hidden" name="state" value="{{ csrf_token() }}" />

You can also specify country. E.g:

<input type="hidden" name="country_code" value="UA">

Testing

$ vendor/bin/phpunit test

Credits

This package is maintained by Tayokin Max.

Change log

Please check out CHANGELOG file for information on what has changed recently.

License

This package is released under the MIT Licence. See the bundled LICENSE file for details.

Related Packages

xmhafiz/fb-page-feed

Simple wrapper class to get any Facebook Page posts

152,027 66
gponster/laravel-facebook-sdk

Facebook SDK wrapper for Laravel 4

12 0
joelbutcher/laravel-facebook-graph

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

185,235 73
carloscsrm/sharelaravel

Share content in Facebook and Twitter

10 0

Version History

Version Released PHP Laravel License
v1.0.3 >=7.1.0 >=5.1 MIT
v1.0.2 >=7.1.0 >=5.1 MIT
v1.0.1 >=7.1.0 >=5.1 MIT