All Projects → iluminar → Fluent Facebook

iluminar / Fluent Facebook

Licence: mit
A laravel 5 package for reading and writing to facebook graph object with ease in laravelish syntax

Projects that are alternatives of or similar to Fluent Facebook

Facebook
📨 Facebook Notifications Channel for Laravel
Stars: ✭ 120 (+144.9%)
Mutual labels:  facebook-api, laravel, laravel-5-package
Angular5.2 Laravel5.6
Angular 5.2 and Laravel 5.6 Authentication and CRUD
Stars: ✭ 17 (-65.31%)
Mutual labels:  laravel, laravel-5-package
Laravel Widgetize
A minimal package to help you make your laravel application cleaner and faster.
Stars: ✭ 791 (+1514.29%)
Mutual labels:  laravel, laravel-5-package
Socialite Mailru
MailRu OAuth2 Provider for Laravel Socialite
Stars: ✭ 25 (-48.98%)
Mutual labels:  laravel, laravel-5-package
Laravel Mysql Spatial
MySQL Spatial Data Extension integration with Laravel.
Stars: ✭ 578 (+1079.59%)
Mutual labels:  laravel, laravel-5-package
Laravel Video Chat
Laravel Video Chat using Socket.IO and WebRTC
Stars: ✭ 646 (+1218.37%)
Mutual labels:  laravel, laravel-5-package
Laravel Tools
路飞laravel工具
Stars: ✭ 24 (-51.02%)
Mutual labels:  laravel, laravel-5-package
Laravel Scout Mysql Driver
Laravel Scout MySQL Driver
Stars: ✭ 491 (+902.04%)
Mutual labels:  laravel, laravel-5-package
Laravel Test Factory Helper
Generate Laravel test factories from your existing models
Stars: ✭ 873 (+1681.63%)
Mutual labels:  laravel, laravel-5-package
Orderable
My very first Laravel package
Stars: ✭ 21 (-57.14%)
Mutual labels:  laravel, laravel-5-package
Laravel User Settings
Simple and persistent boolean settings per user
Stars: ✭ 34 (-30.61%)
Mutual labels:  laravel, laravel-5-package
Ip Location Zh
获取 IP 地址的真实地理位置
Stars: ✭ 556 (+1034.69%)
Mutual labels:  laravel, laravel-5-package
Sudo Su
Laravel package to easily login as other users during development.
Stars: ✭ 554 (+1030.61%)
Mutual labels:  laravel, laravel-5-package
Orm
A drop-in Doctrine ORM 2 implementation for Laravel 5+ and Lumen
Stars: ✭ 712 (+1353.06%)
Mutual labels:  laravel, laravel-5-package
Column Sortable
Package for handling column sorting in Laravel 5/6/7/8
Stars: ✭ 496 (+912.24%)
Mutual labels:  laravel, laravel-5-package
Identity Number
Validator for Swedish personal identity numbers (personnummer). For use "standalone" or with Laravel.
Stars: ✭ 17 (-65.31%)
Mutual labels:  laravel, laravel-5-package
Laravel Settings
Simple Settings package for a laravel application
Stars: ✭ 45 (-8.16%)
Mutual labels:  laravel, laravel-5-package
Telegram
✈️ Telegram Notifications Channel for Laravel
Stars: ✭ 450 (+818.37%)
Mutual labels:  laravel, laravel-5-package
Laravel Js Localization
🌐 Convert your Laravel messages and consume them in the front-end!
Stars: ✭ 451 (+820.41%)
Mutual labels:  laravel, laravel-5-package
Improved Polymorphic Eloquent Builder
🔨 Improved Polymorphic Eloquent Builder
Stars: ✭ 12 (-75.51%)
Mutual labels:  laravel, laravel-5-package

Fluent-Facebook

License StyleCI Twitter URL

Docs

A laravel 5 package for reading and writing to facebook graph object with ease in laravelish syntax. Check out how easy it is to read from facebook graph api.

$user = Auth::user();
$user = Fluent::user($user->fb_id)->get();

That's it. The $user object is a collection (Illuminate\Support\Collection) of facebook user data.

If you want extra information like about, first_name, education etc. just pass an array with the field name in with method.

$user = Auth::user();
$fields = ['hometown', 'first_name', 'about', 'birthday', 'cover', 'education'];
$user = Fluent::user($user->fb_id)->with($fields)->get();

If you want to get the feed of the user just chain the feed method to the user object.

$user = Auth::user();
$feed = Fluent::user($user->fb_id)->feed()->get();

If you want to get information of a post just pass the post id to the post method.

$user = Auth::user();
$posts = Fluent::post($post_id)->get();

Install

You can pull in the package via composer:

$ composer require iluminar/fluent-facebook

Or you can add this in your composer.json

"require": {
    "iluminar/fluent-facebook": "dev-develop"
}

and then terminal from your root directory of project run following command

$ composer update

After updating composer, add a fluent service provider to the providers array in config/app.php file.

 'providers' => array(
        // ...
        Iluminar\Fluent\Providers\FluentServiceProvider::class,
    )

then run in terminal

$ php artisan vendor:publish

to add package tables in your database run following command

$ php artisan migrate

Configuration

First you have to create a facebook app and set the app_id, app_secret and redirect_uri in the configuration file.

'facebook' => [
    'client_id' => env('FB_APP_ID'),
    'client_secret' => env('FB_APP_SECRET'),
    'redirect_uri' => env('FB_REDIRECT_URI'),
],

To define what permissions your app need you can set those permission under scopes key. Just change the value of particular permission scope to true. By default email permission is set to true. Remember, for extra permission you have to submit your app for review by facebook.

'scope' => [
    "public_profile" => false,
    "user_friends" => false,
    "email" => true,
    "user_about_me" => false,
]

For user authentication fluent use laravel's default users table and user model. But if you use different table and model then set those on config file.

'user_model' => 'user',
'user_table_name' => 'users',
'user_model_namespace' => 'App',

Usage

Logging The User Into Laravel

All the routes and authentication logic for authentication via facebook is provided by package. Just add redirect route to your login button, it will redirect the user to facebook login dialog box.

Get different node information

Facebook information is represented as a social graph which composed of following three things

nodes - basically "things" such as a User, a Photo, a Page, a Comment

edges - the connections between those "things", such as a Page's Photos, or a Photo's Comments

fields - info about those "things", such as a person's birthday, or the name of a Page

First you need to instantiate a Fluent instance.

$fluent = new Fluent();

Or if you use fluent facade then you dont need a fluent instance.

Now if you want information about a user or photo, just call a method by that name on fluent object, pass the id of that node i.e id of the user or photo and chained that with get method which will return a collection about that node.

$user = Fluent::user($id)->get();

N.B: The facebook id of the user is saved in fb_id column of the users table.

When you retrieving a node information you can also specify the fields for that node to get extra information. For that just pass an array of fields name to the with method chained to that node call.

$fields = ['link', 'name', 'album'];
$photo = Fluent::photo($id)->with($fields)->get();

To get information of an node's edge (e.g photo's comments) just chain a method by the edge name to the node call.

$photo = Fluent::photo($id)->comments()->get();

Documentation

Docs

TODO

publish option

Error handling

Security Vulnerabilities

If you discover a security vulnerability in the package, please send an e-mail to Nehal Hasnayeen at [email protected]. All security vulnerabilities will be promptly addressed.

License

The Fluent-facebook is open-sourced software licensed under the MIT license.

Change log

Please see CHANGELOG for more information what has changed recently.

Contributor

Made by Hasnayeen with love in Bangladesh

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].