Dział: Strona główna » Blog » FOSUserBundle i FOSFacebookBundle
Zaloguj Kontakt Strona główna

FOSUserBundle i FOSFacebookBundle

dla wersji Symfony2 (2.0)

Moja przykładowa konfiguracja aby zmusić te dwie paczki do współpracy.

# deps
[FOSUserBundle]
  git=git://github.com/FriendsOfSymfony/FOSUserBundle.git
  target=bundles/FOS/UserBundle

[FOSFacebookBundle]
  git=git://github.com/FriendsOfSymfony/FOSFacebookBundle.git
  target=/bundles/FOS/FacebookBundle
  version=origin/2.0

[FacebookSDK]
  git=git://github.com/facebook/facebook-php-sdk.git
  target=/facebook

# app/config/config.yml
#...
fos_user:
  db_driver: orm
  firewall_name: main
  user_class: nBuryloApiBundleEntityUser #klasa user

fos_facebook:
  file: %kernel.root_dir%/../vendor/facebook/src/base_facebook.php
  alias: facebook
  app_id: #APIID
  secret: #APISECRET
  cookie: true
  permissions: [email, user_birthday, user_location]
# app/security.yml
security:
  factories:
    - "%kernel.root_dir%/../vendor/bundles/FOS/
                   FacebookBundle/Resources/config/security_factories.xml"
  encoders:
    "FOSUserBundleModelUserInterface": sha512
  providers:
    fos_userbundle:
      id: fos_user.user_manager
    fos_facebook:
      id: n_burylo_api.facebook.user
  firewalls:
    main:
      pattern: ^/
      form_login:
        login_path: /login
        check_path: /login_check
        provider: fos_userbundle
      fos_facebook:
        login_path: /login
        check_path: /facebook_check
        provider: fos_facebook
      anonymous: ~
      logout:
        path: /logout
        target: /login
#app/config/routing.yml
fos_user_security:
  resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
  resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
  prefix: /profile
fos_user_register:
  resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
  prefix: /register
fos_user_resetting:
  resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
  prefix: /resetting
fos_user_change_password:
  resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
  prefix: /profile
_security_check:
  pattern: /facebook_check
_security_logout:
  pattern: /logout
  • Autor: Łukasz Buryło
Comment icon

Komentarze