A Facebook component for Laravel.

Installs: 10

Dependents: 0

Stars: 1

Watchers: 3

Language: PHP

2.0.0 2013-12-02 04:42 UTC


A Facebook component for Laravel which leverages on Laravel's Facades.


$facebook = new Facebook(array(
  'appId'  => 'YOUR_APP_ID',
  'secret' => 'YOUR_APP_SECRET',

// Get User ID
$user = $facebook->getUser();


// Get User ID
$user = Z\Facebook::getUser();

Laravel Facebook currently supports Facebook 3.2 and Laravel 4.0.


  1. Add the package in your composer.json file, then execute a php composer.phar install (or composer install) command from your root directory.
  2. Register the package, typically, by adding 'Zejesago\Laravel\Facebook\ServiceProvider' in the providers array in app/config/app.php.
  3. (Optional) Add an alias in the aliases array in app/config/app.php. E.g. 'Z\Facebook' => 'Zejesago\Laravel\Facebook\Facade'.
  4. Run php artisan config:publish zejesago/laravel-facebook to create your app-specific configuration, where you can set your app ID and secret.


When doing unit testing, you may encounter some session errors thrown when instatiating Facebook.

Include the following snippet in phpunit.xml:

    <server name="HTTP_HOST" value="localhost"/>
    <server name="REQUEST_URI" value="/"/>
    <server name="path" value="localhost"/>

then run your tests with the --stderr flag to prevent HTTP header generation interruptions.