PHPackages                             akkaweb/cakephp-facebook - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. akkaweb/cakephp-facebook

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

akkaweb/cakephp-facebook
========================

CakePHP 3 Facebook Plugin

3.0.0(7y ago)2114.5k↓50%20[1 PRs](https://github.com/akkaweb/AKKA-CakePHP-Facebook-Plugin/pulls)MITPHPPHP &gt;=5.4

Since Oct 5Pushed 5y ago5 watchersCompare

[ Source](https://github.com/akkaweb/AKKA-CakePHP-Facebook-Plugin)[ Packagist](https://packagist.org/packages/akkaweb/cakephp-facebook)[ RSS](/packages/akkaweb-cakephp-facebook/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (13)Used By (0)

> IMPORTANT: SUPPORT FOR THIS BRANCH HAS BEEN DISCONTINUED. Use SDK5 Branch or latest tagged version. This branch (Master) will be kept to support Facebook SDKv4 but will not continue to be improved. I am currently working on supporting Facebook SDKv5. Follow installation instructions in that branch.

CakePHP 3 Facebook Plugin
=========================

[](#cakephp-3-facebook-plugin)

A CakePHP 3.x Plugin to allow Facebook Login into an application.

[![Total Downloads](https://camo.githubusercontent.com/b94200be6359de91073c0834777a6f7a1ff30e91ea15ef00673f434acf3eb3ca/68747470733a2f2f706f7365722e707567782e6f72672f616b6b617765622f63616b657068702d66616365626f6f6b2f646f776e6c6f6164732e737667)](https://packagist.org/packages/akkaweb/cakephp-facebook)[![License](https://camo.githubusercontent.com/37f38a70b9f0e94087e288adb4b8a8ae27394ff3e316a5fec27d277699226f2f/68747470733a2f2f706f7365722e707567782e6f72672f616b6b617765622f63616b657068702d66616365626f6f6b2f6c6963656e73652e737667)](https://packagist.org/packages/akkaweb/cakephp-facebook)[![Gitter](https://camo.githubusercontent.com/0554258bc653f187de8b8ebee0ca9a21294e136e9995901a49aec3cc40d841e9/68747470733a2f2f6261646765732e6769747465722e696d2f616b6b617765622f414b4b412d43616b655048502d46616365626f6f6b2d506c7567696e2e737667)](https://gitter.im/akkaweb/AKKA-CakePHP-Facebook-Plugin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

Requirements
------------

[](#requirements)

- CakePHP 3.x with Auth component correctly setup. Refer to  for setup
- PHP 5.4.6+
- Facebook PHP SDK 4.0+
- Users Table with at least the following columns
    - `facebook_id varchar(20)`
    - `first_name` // can be set in config
    - `last_name` // can be set in config
    - `username` // can be set in config
    - `password` // can be set in config

For existing applications that already have a `first_name`, `last_name`, `username` and `password` already created with a different column name, you can dynamically set it in configuration options when loading the `Component` to your `AppController.php` file. See section 2 of Configuration below

NOTE: Facebook PHP SDK is a requirement. Composer will automatically install Facebook for you if not already installed. If manual download is chosen, you must download the Facebook Source into `vendor/facebook/php-sdk-v4` and make sure it can be loaded by the composer. Else you need to manually include FAcebook's `autoload.php` file in your application's `bootstrap.php`.

Included
--------

[](#included)

- Facebook Graph Component
- Facebook Graph Helper
    - $this-&gt;Facebook-&gt;loginLink()
    - $this-&gt;Facebook-&gt;likeButton()
    - $this-&gt;Facebook-&gt;shareButton()
    - $this-&gt;Facebook-&gt;sendButton()
    - $this-&gt;Facebook-&gt;followButton()
    - $this-&gt;Facebook-&gt;comments()
    - $this-&gt;Facebook-&gt;embeddedPosts()
    - $this-&gt;Facebook-&gt;embeddedVideo()
    - $this-&gt;Facebook-&gt;page()

\*\*\*\*\* See below for more details on how to use each

Installation
------------

[](#installation)

##### Composer (Best Choice)

[](#composer-best-choice)

1. Add the following to your `composer.json` located in the root of your application, in the `require` section . ie. `/var/www/domain.com/composer.json`

```
// NOTE: Use instructions in SDK5 Branch if this is a new installation. This branch his no longer supported.

"require": {
	"akkaweb/cakephp-facebook": "dev-master"
}
```

2. Run the following at the root of your application

```
sudo php composer.phar update

```

Note: if `composer.phar` is not found, you need to install it. Follow CakePHP's documentation here -&gt; . Refer to Installing Cakephp section

##### Git Clone (plugins/AkkaFacebook)

[](#git-clone-pluginsakkafacebook)

`git clone git@github.com:akkaweb/AKKA-CakePHP-Facebook-Plugin.git`

##### Download

[](#download)

`https://github.com/akkaweb/AKKA-CakePHP-Facebook-Plugin/archive/master.zip`

Note: When installing with either manual download or Git Clone and CakePHP complains it cannot find the plugin, you need to add the plugin to `vendor/cakephp-plugins.php` in the `plugins` array \[\] --&gt; `'AkkaFacebook' => $baseDir . '/plugins/AkkaFacebook/'`. If you are using composer, running `php composer.phar dumpautoload` could be sufficient. If it does not work add the following to the `"autoload"` section in the root application's `composer.json` file in the `"psr-4":` section: `"AkkaFacebook\\": "./plugins/AkkaFacebook/src"`

Configuration
-------------

[](#configuration)

1. Load the plugin in your application's `bootstrap.php` file:

```
Plugin::load('AkkaFacebook', ['bootstrap' => false, 'routes' => true]);
```

2. Load the plugin's component in `AppController.php`

Note: You need to obtain your facebook `App Id` and `App Secret` from . Once you are on that page and have an App created, you can retrieve your `App Id` and `App Secret`. Make sure you add your domain to `App Domains` in the `Settings` page.

`user_columns` is optional and should only be used if your `Users` database columns defer from the defaults as specified in the Requirement section, above.

```
public function initialize(){
    parent::initialize();

    $this->loadComponent('AkkaFacebook.Graph', [
	    'app_id' => 'your-fb-app-id',
	    'app_secret' => 'your-fb-app-secret',
	    'app_scope' => 'email,public_profile', // https://developers.facebook.com/docs/facebook-login/permissions/v2.4
	    'redirect_url' => Router::url(['controller' => 'Users', 'action' => 'login'], TRUE), // This should be enabled by default
	    'post_login_redirect' => '' //ie. Router::url(['controller' => 'Users', 'action' => 'account'], TRUE)
	    // 'user_columns' => ['first_name' => 'fname', 'last_name' => 'lname', 'username' => 'uname', 'password' => 'pass'] //not required
    ]);
}
```

Usage
-----

[](#usage)

Note: FacebookHelper is automatically loaded by the `Graph Component`. If that is not desired, add `'enable_graph_helper' => false,` to `$this->loadComponent()` above.

##### Helper Template File Setup

[](#helper-template-file-setup)

- Add `` immediately after the opening `` tag

##### Login Link (Customizable Facebook link &lt;a href)

[](#login-link-customizable-facebook-link-a-href)

Reference -

```
Optional Settings Array
* id 	-> Link id
* class -> Link class
* title -> Link title
* style -> Any html style
* label -> Hyperlink text

``

```

##### Like Button (Facebook Like)

[](#like-button-facebook-like)

Reference -

```
Default Options
* 'action' => 'like', // like, recommend
* 'share' => true,
* 'width' => 450,
* 'show-faces' => true,
* 'layout' => 'standard' // standard, box_count, button_count, button

``

```

##### Share Button (Facebook Share)

[](#share-button-facebook-share)

Reference -

```
Default Options
* 'layout' => 'button_count' // button_count/box_count/button/icon_link/icon/link

``

```

##### Send Button (Facebook Send)

[](#send-button-facebook-send)

Reference -

```
Default Options
* 'width' => 50,
* 'height' => 30,
* 'colorscheme' => dark

``

```

##### Follow Button (Facebook Follow)

[](#follow-button-facebook-follow)

Reference -

```
Default Options
* 'width' => 300,
* 'height' => 100,
* 'colorscheme' => 'light',
* 'layout' => 'standard',
* 'show-faces' => false,
* 'kid-directed-site' => false

``

```

##### Comments (Facebook Comments)

[](#comments-facebook-comments)

Reference -

```
Default Options
* 'colorscheme' => light, // light/dark
* 'mobile' => 'Auto-detected',
* 'num-posts' => 10,
* 'order-by' => 'social', // social/reverse_time/time
* 'width' => 550

``

```

##### Embedded Posts (Facebook Embedded Posts)

[](#embedded-posts-facebook-embedded-posts)

Reference -

```
Default Options
* 'width' => 500

``

```

##### Embedded Video (Facebook Embedded Video)

[](#embedded-video-facebook-embedded-video)

Reference -

```
Default Options
* 'href' => ''
* 'width' => 500

``

```

##### Page Plugin (Facebook Page Plugin)

[](#page-plugin-facebook-page-plugin)

Reference -

```
Default Options
* 'href' => 'https://www.facebook.com/facebook',
* 'height' => 300,
* 'hide-cover' => false,
* 'show-facepile' => true,
* 'show-posts' => false,
* 'width' => 500

``

```

#### Coming Soon

[](#coming-soon)

- Feed Dialog

Disclaimer
----------

[](#disclaimer)

Although we have done many tests to ensure this plugin works as intended, we advise you to use it at your own risk. As with anything else, you should first test any addition to your application in a test environment. Please provide any fixes or enhancements via issue or pull request.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 94.4% 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 ~302 days

Recently: every ~318 days

Total

6

Last Release

2003d ago

Major Versions

2.0.2 → 3.0.02018-12-14

3.0.0 → 4.0.0.x-dev2020-11-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/6accb04ee7527cd65f5241bc1aa86ef76cd5d773d43b93566d16b2ed0d1c48b4?d=identicon)[akkaweb](/maintainers/akkaweb)

---

Top Contributors

[![akkaweb](https://avatars.githubusercontent.com/u/428229?v=4)](https://github.com/akkaweb "akkaweb (67 commits)")[![kaffineaddict](https://avatars.githubusercontent.com/u/1271668?v=4)](https://github.com/kaffineaddict "kaffineaddict (2 commits)")[![gbalabasquer](https://avatars.githubusercontent.com/u/12644398?v=4)](https://github.com/gbalabasquer "gbalabasquer (1 commits)")[![hkosmidi](https://avatars.githubusercontent.com/u/146776?v=4)](https://github.com/hkosmidi "hkosmidi (1 commits)")

---

Tags

cakephpcomposerfacebookfacebook-php-sdkphpfacebookcakephpcakephp3

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/akkaweb-cakephp-facebook/health.svg)

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

###  Alternatives

[kartik-v/yii2-social

Module containing useful widgets for Yii Framework 2.0 that integrates social functionalities from DISQUS, Facebook, Google etc.

91256.5k8](/packages/kartik-v-yii2-social)

PHPackages © 2026

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