PHPackages                             becklyn/facebook-bundle - 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. [API Development](/categories/api)
4. /
5. becklyn/facebook-bundle

AbandonedArchivedSymfony-bundle[API Development](/categories/api)

becklyn/facebook-bundle
=======================

This bundle provides basic components for the usage with facebook

v1.0.0(8y ago)21491BSD-3-ClausePHP

Since Jan 18Pushed 8y agoCompare

[ Source](https://github.com/Becklyn/BecklynFacebookBundle)[ Packagist](https://packagist.org/packages/becklyn/facebook-bundle)[ Docs](https://github.com/Becklyn/BecklynFacebookBundle)[ RSS](/packages/becklyn-facebook-bundle/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (8)Versions (13)Used By (0)

BecklynFacebookBundle
=====================

[](#becklynfacebookbundle)

This bundle provides basic components for the usage with facebook.

Facebook App Model
------------------

[](#facebook-app-model)

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

#### Definition

[](#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.

This data is capsuled in three value objects:

- `Page`
    - Bundles the page like, page admin and page id
- `RequestUser`
    - Age, country &amp; 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).

Furthermore the App Model provides the following:

- 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
---------------

[](#twig-extensions)

### Facebook Utilities Twig Extension

[](#facebook-utilities-twig-extension)

#### Definition

[](#definition-1)

This extension is automatically registered.

#### Usage

[](#usage)

Provides the following Twig functions:

- `{{ 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

[](#facebook-app-twig-extension)

Provides twig functions which are related to FacebookAppModel.

#### Definition

[](#definition-2)

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

#### Usage

[](#usage-1)

Provides the following Twig functions:

- `{{ 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

[](#additional-information)

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

```
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:

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

CSS &amp; SCSS
--------------

[](#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.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 88.1% 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 ~161 days

Recently: every ~359 days

Total

12

Last Release

3095d ago

Major Versions

v0.2.5 → v1.0.0-alpha12013-12-16

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1044355?v=4)[Becklyn Studios](/maintainers/becklyn)[@Becklyn](https://github.com/Becklyn)

![](https://www.gravatar.com/avatar/978a2e9c861659e539e4f097514214657483a542d01ddb72e1cdf0ef6bc7a2c6?d=identicon)[apfelbox](/maintainers/apfelbox)

![](https://www.gravatar.com/avatar/653e3e61f49a77663a3ae00388c79423763180e19e4eba9d8cfe0b9c68be1443?d=identicon)[tk](/maintainers/tk)

---

Top Contributors

[![apfelbox](https://avatars.githubusercontent.com/u/1032411?v=4)](https://github.com/apfelbox "apfelbox (37 commits)")[![mario-becklyn](https://avatars.githubusercontent.com/u/12392822?v=4)](https://github.com/mario-becklyn "mario-becklyn (4 commits)")[![ackidri](https://avatars.githubusercontent.com/u/377760?v=4)](https://github.com/ackidri "ackidri (1 commits)")

---

Tags

deprecatedsymfonyfacebook

### Embed Badge

![Health badge](/badges/becklyn-facebook-bundle/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

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