2017 © Pedro Peláez
 

library fluent-facebook

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

image

iluminar/fluent-facebook

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

  • Tuesday, November 1, 2016
  • by Hasnayeen
  • Repository
  • 2 Watchers
  • 45 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Fluent-Facebook

License StyleCI Twitter URL, (*1)

Docs, (*2)

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. ``` php $user = Auth::user(); $user = Fluent::user($user->fb_id)->get();, (*3)

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.
``` php
$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. ``` php $user = Auth::user(); $feed = Fluent::user($user->fb_id)->feed()->get();, (*4)



If you want to get information of a post just pass the post id to the `post` method. ``` php $user = Auth::user(); $posts = Fluent::post($post_id)->get();

Install

You can pull in the package via composer: ``` bash $ composer require iluminar/fluent-facebook, (*5)


Or you can add this in your composer.json ``` bash "require": { "iluminar/fluent-facebook": "dev-develop" }

and then terminal from your root directory of project run following command ``` bash $ composer update, (*6)


After updating composer, add a fluent service provider to the providers array in config/app.php file. ``` php 'providers' => array( // ... Iluminar\Fluent\Providers\FluentServiceProvider::class, )

then run in terminal ``` bash $ php artisan vendor:publish, (*7)


to add package tables in your database run following command ``` bash $ 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. ``` php 'facebook' => [ 'client_id' => env('FB_APP_ID'), 'client_secret' => env('FB_APP_SECRET'), 'redirect_uri' => env('FB_REDIRECT_URI'), ],, (*8)


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. ``` php '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. ``` php 'user_model' => 'user', 'user_table_name' => 'users', 'user_model_namespace' => 'App',, (*9)


## 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. ``` php $fluent = new Fluent();

Or if you use fluent facade then you dont need a fluent instance., (*10)

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. ``` php $user = Fluent::user($id)->get();, (*11)

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.
``` php
$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. php $photo = Fluent::photo($id)->comments()->get();, (*12)

Documentation

Docs, (*13)

TODO

publish option, (*14)

Error handling, (*15)

Security Vulnerabilities

If you discover a security vulnerability in the package, please send an e-mail to Nehal Hasnayeen at searching.nehal@gmail.com. All security vulnerabilities will be promptly addressed., (*16)

License

The Fluent-facebook is open-sourced software licensed under the MIT license., (*17)

Change log

Please see CHANGELOG for more information what has changed recently., (*18)

Contributor

Made by Hasnayeen with love in Bangladesh, (*19)

The Versions

01/11 2016

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by nhasnayeen

laravel facebook graph-api facebook-graph-api

29/10 2016

dev-analysis-zDMnmJ

dev-analysis-zDMnmJ

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by nhasnayeen

laravel facebook graph-api facebook-graph-api

11/08 2016

dev-analysis-XNdLey

dev-analysis-XNdLey

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by nhasnayeen