2017 © Pedro Peláez
 

symfony-bundle facebook-bundle

This bundle provides basic components for the usage with facebook

image

becklyn/facebook-bundle

This bundle provides basic components for the usage with facebook

  • Thursday, November 23, 2017
  • by apfelbox
  • Repository
  • 2 Watchers
  • 2 Stars
  • 136 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 13 Versions
  • 0 % Grown

The README.md

BecklynFacebookBundle

This bundle provides basic components for the usage with facebook., (*1)

Facebook App Model

A model which handles a lot of app ("real" app or page tab app) related logic., (*2)

Definition

Facebook\Facebook:
    arguments: 
        - app_id: '123456'
          app_secret: 'thisisyoursecret'

Becklyn\FacebookBundle\Model\FacebookAppModel:
    arguments:
        - '@Facebook\Facebook'
        - '@session'
        - '@router'
        - "https://www.facebook.com/Symfony2Framework"          # the fan page url
        - ["email", "user_birthday", "publish_stream"]          # your required permissions
        - "session_identifier"                                  # if you need to use multiple services, you need to define unique session identifiers

This class bundles a lot of the functionality connected to app development with Facebook. It automatically loads the user api data (from a /me request), user request data (from the signed request) and the page data (also from the signed request). Also these values are persistent in the session, so you can safely navigate inside your app iframe without losing all the data., (*3)

This data is capsuled in three value objects:, (*4)

  • Page
    • Bundles the page like, page admin and page id
  • RequestUser
    • Age, country & locale
  • ApiUser
    • Everything from the /me request. Includes direct getters for the most frequent used data (from base permissions + email + user_birthday)

All value objects always contain the complete data as provided by Facebook. You can either use the direct getters or use the getByKey to get data for a value without a direct getter (like if you use more permissions)., (*5)

Furthermore the App Model provides the following:, (*6)

  • Direct access to flags, whether the user has liked the page and provided the permissions
  • Getter whether the user is looking at the app in facebook, but not inside your page (like if the user looks at the page as real app and not as page tab, is not persisted between page changes)
  • Page Tab URL generator (including embedding data in app_data)
  • app_data access
  • Wrapper for wall posts

Twig Extensions

Facebook Utilities Twig Extension

Definition

This extension is automatically registered., (*7)

Usage

Provides the following Twig functions:, (*8)

  • {{ fb_likeButton(url, dataAttributes = {}) }} Generates the HTML of a facebook button. You can set all data-attributes in the second argument (omit the data, so provide {href: "..."} for data-href="...")
  • {{ fb_profileImage(facebookId) }} Generates the URL to the profile image for the given facebook id.
  • {{ fb_profileUrl(facebookId) }} Generates the URL to the profile page for the given facebook id.
  • {{ fb_truncateLikeDescriptionText(text, length = 80) }} Truncates the given text and strips all HTML tags from it. The second parameter defines, where the text is truncated ("..." is appended if the text is truncated). The truncation will break words.

Facebook App Twig Extension

Provides twig functions which are related to FacebookAppModel., (*9)

Definition

twig.extension.facebook_app:
    class: Becklyn\FacebookBundle\Service\FacebookAppTwigExtension
    tags:
        - { name: twig.extension }
    arguments: [@facebook_app_model]    # definition from above

Usage

Provides the following Twig functions:, (*10)

  • {{ fb_permissionsData(redirectRoute, redirectRouteParameters = {}) }} Returns an array with two keys: {"hasPermissions": false, "permissionsUrl": "..."}. Can be used json encoded to implement a permissions switch in your app. Expects the redirect route (with parameters) which are needed for the redirect uri used in the generation of the facebook login url.
  • {{ fb_appId() }} Returns the app id as defined in the model.

Additional information

If you use multiple facebook app models, you can automatically prefix these twig functions. The session identifier is used for the prefixing, (*11)

facebook_app_model_shop:
    class: Becklyn\FacebookBundle\Model\FacebookAppModel
    arguments:
        # ...
        - "shop"        # the session identifier

twig.extension.facebook_app_shop:
    class: Becklyn\FacebookBundle\Service\FacebookAppTwigExtension
    tags:
        - { name: twig.extension }
    arguments: [@facebook_app_model_shop, true]    # The true marks that the functions should be prefixed

The twig functions will now be called:, (*12)

{{ fb_shop_permissionsData(redirectRoute, redirectRouteParameters = {}) }}
{{ fb_shop_appId() }}

CSS & SCSS

Only one scss file is included, which sets the width and the overflow for an element with the id #fb-wrap, to automatically fit in the app iframe. You can @import it into your own SCSS file., (*13)

The Versions

08/07 2014

v1.0.0-rc1

1.0.0.0-RC1 https://github.com/Becklyn/BecklynFacebookBundle

This bundle provides basic components for the usage with facebook

  Sources   Download

BSD-3-Clause

The Requires

 

symfony facebook

10/02 2014

v1.0.0-beta2

1.0.0.0-beta2 https://github.com/Becklyn/BecklynFacebookBundle

This bundle provides basic components for the usage with facebook

  Sources   Download

BSD-3-Clause

The Requires

 

symfony facebook

17/12 2013

v1.0.0-beta1

1.0.0.0-beta1 https://github.com/Becklyn/BecklynFacebookBundle

This bundle provides basic components for the usage with facebook

  Sources   Download

MIT

The Requires

 

symfony facebook

16/12 2013

v1.0.0-alpha1

1.0.0.0-alpha1 https://github.com/Becklyn/BecklynFacebookBundle

This bundle provides basic components for the usage with facebook

  Sources   Download

MIT

The Requires

 

symfony facebook

28/11 2013

v0.2.5

0.2.5.0 https://bitbucket.org/becklyn/oagm-facebook-bundle

This bundle provides basic components for the usage with facebook

  Sources   Download

The Requires

 

facebook

12/06 2013

v0.2.4

0.2.4.0 https://bitbucket.org/becklyn/oagm-facebook-bundle

This bundle provides basic components for the usage with facebook

  Sources   Download

The Requires

 

facebook

12/06 2013

v0.2.3

0.2.3.0 https://bitbucket.org/becklyn/oagm-facebook-bundle

This bundle provides basic components for the usage with facebook

  Sources   Download

The Requires

 

facebook

12/06 2013

v0.2.2

0.2.2.0 https://bitbucket.org/becklyn/oagm-facebook-bundle

This bundle provides basic components for the usage with facebook

  Sources   Download

The Requires

 

facebook

24/04 2013

v0.2.1

0.2.1.0 https://bitbucket.org/becklyngmbh/oagm-facebook-bundle

This bundle provides basic components for the usage with facebook

  Sources   Download

The Requires

 

facebook

24/04 2013

v0.2

0.2.0.0 https://bitbucket.org/becklyngmbh/oagm-facebook-bundle

This bundle provides basic components for the usage with facebook

  Sources   Download

The Requires

 

facebook

18/01 2013

v0.1

0.1.0.0

This bundle provides basic components for the usage with facebook

  Sources   Download

The Requires

 

facebook