Skip to content

Pollenizer/CakePHP-Facebook-Plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CakePHP Facebook Plugin

A CakePHP Plugin used for interfacing with the Facebook PHP SDK.

For a full list of available methods and properties, please refer to the Facebook PHP SDK Overview

Installation

  1. Copy the plugin to app/Plugin/Facebook
  2. Enable the plugin in app/Config/bootstrap.php

Configuration

In your controller:

public $components = array(
    'Facebook.Facebook' => array(
        'appId' => YOUR_FACEBOOK_APP_ID,
        'appSecret' => YOUR_FACEBOOK_APP_SECRET
    )
);

public $helpers = array(
    'Facebook.Facebook' => array(
        'appId' => YOUR_FACEBOOK_APP_ID,
        'appSecret' => YOUR_FACEBOOK_APP_SECRET
    )
);

Usage

The following example shows how to use the FacebookHelper::getLoginUrl method to create a Facebook login link.

echo $this->Html->link(__('Login with Facebook'), $this->Facebook->getLoginUrl(array(
    'redirect_uri' => $this->Html->url('/', true),
    'scope' => 'email,user_interests,user_location'
)));

The following example shows how to use the FacebookHelper::likeButton method to create a Facebook Like Button.

echo $this->Facebook->likeButton(array(
    'href' => $this->Html->url(array('controller' => 'posts', 'action' => 'view', 123), true),
    'send' => 'false',
    'layout' => 'button_count',
    'width' => '450',
    'show_faces' => 'false',
    'action' => 'recommend'
));

About

A CakePHP Plugin used to interface with the Facebook PHP SDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages