Created: 2011-07-07 13:22
Updated: 2013-10-01 07:36
License: mit



@author: Jo Carter (jocarter@holler.co.uk), Jimmy Wong (jimmywong@holler.co.uk), Ben Lancaster (benlancaster@holler.co.uk)

@version: 1.0


This is a customised project creation process geared towards Facebook development.

It includes an installer that'll create a Facebook application, a tab module, and copy files with useful code to deal with access tokens and user authentication within Facebook.

The plugin also includes extensions to the web debug bar for profiling API calls.

To make API calls, rather than instantiating an instance of the Facebook SDK, use:



Additional Plugin installed:


All projects

NOTE: svn:externals included below.

  1. Check out the project locally, assuming this was generated by Trac then it should have a folder structure and symfony installed in lib/vendor

  2. Add the plugin to your plugins folder (NOTE: the installer will take care of the rest)

    sfFacebookAppPlugin https://github.com/HollerLondon/sfFacebookAppPlugin.git/trunk

New project

  1. Generate the project using the installer:

    php lib/vendor/symfony/data/bin/symfony generate:project --installer=plugins/sfFacebookAppPlugin/data/installer.php PROJECTNAME
  2. Create a Facebook app and fill in your Facebook app details in the frontend app.yml, NOTE: If creating a Facebook tab make sure you use YOUR_URL/tab as the starting url

  3. Then, in the action where you want to authorise the app with the user add:

    if (false === $this->access_token && $this->signed_request) $this->redirect('@auth?signed_request='.$this->signed_request);
  4. If you want to request additional permissions (not in the regular scope)

     $additionalScope = 'email';
     if (false === $this->access_token && $this->signed_request) $this->redirect(sprintf('@auth_scope?scope=%s&signed_request=%s', $additionalScope, $this->signed_request));
  5. If you want to be able to interact with the tab whilst using Facebook as the page (the like button disappears), you need to disable the like gate for admins only:

           enabled:           true
           enabled_for_admin: false   # disable for "use as page"
  6. If you want to Google track the source of incoming tab links, you'll want to enable the tracking - Facebook tabs only. NOTE: You'll need to make sure when linking to a tab or doing any redirects you include the ?app_data with the required source - e.g: TAB_URL?app_data=source_SOURCE

         enabled:            true
         prefix:             source_
         utm_campaign:       CAMPAIGN
         utm_medium:         MEDIUM

Existing project

  1. Install the extra plugins and vendors mentioned above

  2. Enable plugin in ProjectConfiguration

  3. And enable the module in the app's settings.yml

    enabled_modules:        [ sfFacebookAppTab ]
  4. Include the signed request filter in the app's filters.yml

    # insert your own filters here
      class: sfFacebookSignedRequestFilter
  5. And configure config/autoload.yml to include the Facebook SDK:

        name:       facebook
        path:       %SF_LIB_DIR%/vendor/facebook/src
  6. Follow above from step 2. (NOTE that the installer does a lot of the groundwork for you - so have a look at the files in there)

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more