Code Monkey home page Code Monkey logo

facebook's Introduction

Facebook

Facebook PHP SDK for Laravel

Add boparaiamrit/facebook to composer.json.

"boparaiamrit/facebook": "dev-master"

Run composer update to pull down the latest version of Facebook.

Now open up app/config/app.php and add the service provider to your providers array.

'providers' => array(
    'Boparaiamrit\Facebook\FacebookServiceProvider',
)

Now add the alias.

'aliases' => array(
    'Facebook' => 'Boparaiamrit\Facebook\FacebookFacade',
)

Configuration

Run php artisan config:publish boparaiamrit/facebook and modify the config file with your own informations.

  1. AppId => If you donot have appId then get it from facebook developer apps.
  2. Secret => Its come with appId.
  3. Redirect => Specify redirect url after logged in with facebook.
  4. Logout => When somebody logout from your site, it redirects to logout url.
  5. Scope => These are permission you want from your users.

Examples

  1. Get Login Url with your credentials and scope.

    Route::get('/', function() { return Facebook::loginUrl(); });

  2. Get User Id

    Route::get('/', function() { return Facebook::getUser(); });

  3. Use facebook API

    Route::get('/', function() { $profile = Facebook::api('/me?fields=id,name,first_name,last_name,username,email,gender,birthday,hometown,location,picture.width(100)'); });

  4. Get Logout Url

    Route::get('/', function() { return Facebook::logoutUrl(); });

  5. FQL

    Route::get('/', function() { return Facebook::api(array( 'method' => 'fql.query', 'query' => "SELECT uid, sex, username, birthday, education, work FROM user WHERE uid = me()", )); });

@todo

Shifiting FB SDK from 3.2.2 to v4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.