PHPackages                             rocker/facebook-login - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. rocker/facebook-login

ActiveLibrary[HTTP &amp; Networking](/categories/http)

rocker/facebook-login
=====================

Package that makes it possible to authenticate against a PHP-Rocker application using facebook (https://github.com/victorjonsson/PHP-Rocker)

1.0.5(13y ago)09MITPHPPHP &gt;=5.3.2

Since May 18Pushed 13y ago1 watchersCompare

[ Source](https://github.com/victorjonsson/PHP-Rocker-facebook-login)[ Packagist](https://packagist.org/packages/rocker/facebook-login)[ RSS](/packages/rocker-facebook-login/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

PHP-Rocker - Facebook login
===========================

[](#php-rocker---facebook-login)

Install this package in your [Rocker application](https://github.com/victorjonsson/PHP-Rocker) and you will have a restful API that can authenticate users that has logged in using their facebook identities.

*This installation walk through takes for granted that you have some prior knowledge about [composer](http://getcomposer.org)*

### 1) Install PHP-Rocker

[](#1-install-php-rocker)

Here you can read more about [how to get started](https://github.com/victorjonsson/PHP-Rocker#installation) with PHP-Rocker

### 2) Add the facebook login package

[](#2-add-the-facebook-login-package)

Add `"rocker/facebook-login" : "1.*"` to the application requirements in *composer.json* and run `composer update` in the console.

### 3) Edit config.php

[](#3-edit-configphp)

In the file config.php you add your facebook application data and change the authentication class to Rocker\\FacebookLogin\\Authenticator. You will also have to add the facebook connect operation.

```
return array(
    ...

    'application.operations' => array(
        ...
        'facebook/connect' => '\\Rocker\\FacebookLogin\\Connect'
    ),

    'application.auth' => array(
        'class' => '\\Rocker\\FacebookLogin\\Authenticator',
        'mechanism' => 'facebook realm="your.website.com"'
    ),

    ...

    'facebook' => array(

        'id' => 'Facebook app id',
        'secret' => 'Facebook app secret',

        # (Optional) Comma separated string with data fields in the facebook response that
        # should saved as user meta when the user gets connected
        'connect_data' => 'birthday,locale',

        # (Optional) Comma separated string with authentication mechanisms that should be disabled
        'disabled_auth_mechanisms' => 'rc4,basic',
    )

);
```

### 4) Implementation

[](#4-implementation)

The following example uses [rocker.js](https://github.com/victorjonsson/rocker.js) together with Facebook javascript SDK

```

    Login with FB

    // Initiate FB
    FB.init({
        appId      : FB_APP_ID,
        status     : true,
        cookie     : false,
        oauth      : false
    });

    // Instantiate the Rocker server
    var rocker = new Rocker('https://api.mywebsite.com/');

    var onFacebookLogin = function() {

        // Connect user
        rocker.request({
            path : 'facebook/connect?access_token='+FB.getAccessToken(),
            method : 'POST',
            onComplete : function(status, json, http) {

                // set facebook auth data
                rocker.auth = 'facebook '+FB.getAuthResponse().userID+':'+FB.getAccessToken();

                // From here on you can access any operation that requires authentication
                rocker.me(function(rockerUser) {
                    console.log(rockerUser);
                });
            }
        });

    };

    // When user clicks on login button
    document.getElementById('login-button').onclick = function() {

        // Check login status
        FB.getLoginStatus(function(response) {
            if (response.status === 'connected') {
                onFacebookLogin();
            } else {

                // Login
                FB.login(function(response) {
                    if(response.status == 'connected') {
                        onFacebookLogin();
                    }
                }, {scope: 'email,user_birthday,user_location'});
            }
        });
    };

```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

3

Last Release

4790d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/400fc7363b72aabbb4b7d8cbc241a8d7dffb9ca4844ce4403e9511313192e232?d=identicon)[vic](/maintainers/vic)

---

Top Contributors

[![victorjonsson](https://avatars.githubusercontent.com/u/429182?v=4)](https://github.com/victorjonsson "victorjonsson (10 commits)")

---

Tags

httpapirestfacebookrestfulwebservice

### Embed Badge

![Health badge](/badges/rocker-facebook-login/health.svg)

```
[![Health](https://phpackages.com/badges/rocker-facebook-login/health.svg)](https://phpackages.com/packages/rocker-facebook-login)
```

###  Alternatives

[nategood/httpful

A Readable, Chainable, REST friendly, PHP HTTP Client

1.8k17.5M274](/packages/nategood-httpful)[cundd/rest

REST API for TYPO3 CMS

77122.1k1](/packages/cundd-rest)[wellrested/wellrested

Simple PHP Library for RESTful APIs

4819.2k4](/packages/wellrested-wellrested)[msankhala/parsehub-php

Php wrapper classes for Parsehub REST api.

1312.4k](/packages/msankhala-parsehub-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
