Facebook Connect symfony plugin (extends sfGuardPlugin)
PHP
Switch branches/tags
Nothing to show
Latest commit cd036ba Jan 29, 2013 @dunglas Merge pull request #2 from GromNaN/patch-1
Create composer.json
Permalink
Failed to load latest commit information.
config
lib
modules/kdGuardAuthFacebookConnect
.gitignore
.gitmodules Changed deprecated Facebook PHP SDK repository Aug 24, 2012
LICENSE
TODO
catalog.xml
composer.json
kdDoctrineGuardFacebookConnectPlugin-0.0.1.tgz
package.xml Symfony plugin PEAR package Mar 12, 2011
readme.md

readme.md

Facebook Connect for symfony and sfGuard

kdDoctrineGuardFacebookConnectPlugin provides an easy way to sign into a symfony 1 application using a Facebook account. It extends sfDoctrineGuardPlugin.

Installation

  • Install and configure sfDoctrineGuardPlugin

  • Install kdDoctrineGuardFacebookConnectPlugin

    # Example using git
    git submodule add http://github.com/dunglas/kdDoctrineGuardFacebookConnectPlugin.git plugins/kdDoctrineGuardFacebookConnectPlugin
  • Create your Facebook application

  • Enable the plugin in the config/ProjectConfiguration.class.php file after sfDoctrineGuardPlugin.

    class ProjectConfiguration extends sfProjectConfiguration {
      public function setup()
      {
        $this->enablePlugins('sfDoctrinePlugin');
        $this->enablePlugins('sfDoctrineGuardPlugin');
        $this->enablePlugins('kdDoctrineGuardFacebookConnectPlugin');
      }
    }
  • Rebuild your database and classes

    php symfony doctrine:build --all --and-load
  • Edit app.yml to match your Facebook application settings

    all:
      facebook:
      appId:                  xxx   # Your app id
      secret:                 yyy   # Your app secret
      cookie:                 true  # Use cookie
      script_lang:            en_US # Facebook UI language
  • Edit filters.yml to enable the FacebookConnect filter

    rendering: ~
    security:  ~
    
    # Facebook Connect
    facebook:
      class: kdDoctrineGuardFacebookConnectFilter
    
    # Remember me
    remember_me:
      class: sfGuardRememberMeFilter
    
    # insert your own filters here
    
    cache:     ~
    execution: ~
  • Enable the kdGuardAuthFacebookConnect module and set is a signin module in settings.yml

    all:
      .settings:
        # ...
        enabled_modules:        [default, sfGuardAuth, kdGuardAuthFacebookConnect]
    
        login_module:           kdGuardAuthFacebookConnect
        login_action:           signin
  • Add the Facebook Login button JavaScript before the body end tag in your app's layout

    ...
    <?php include_slot('fb_connect') ?>
    </body>
    ...
  • Update your templates to use the route kd_guard_signin for signin and kd_guard_signout for logout instead of the sfDoctrineGuard default routes

  • Clear the cache with php symfony cc and enjoy!