Facebook Plugin v2.0 -- Graph System!
Please Support:
CakePHP Facebook Plugin
Info:
- Version: 4.0
- Requirements: CakePHP 1.3/2.x, PHP5.1+
- Docs: CakePHP Facebook Plugin API
- Article: CakePHP Facebook Plugin Discussion and Examples
Watch:
- Screencast: CakePHP Facebook Plugin Screencast
Get it:
- Download Now
- git clone git://github.com/webtechnick/CakePHP-Facebook-Plugin facebook
CakePHP Facebook Plugin v2.0 is here! With the help from Theaxiom (https://github.com/theaxiom) the popular CakePHP Facebook plugin is now updated to the newest PHP SDK which features among other things full access to the much anticipated Facebook Graph System.
Some Examples of the newest features are:
Example:
New Configuration File Example:
New ConnectComponent::user() Examples:
New Layout Example:
[geshi=html] = $facebook->html(); ?> Facebook Plugin Example = $facebook->init(); ?>
New Features
Along with access to the new SDK, I've implemented some great new fbxml features- Like (let your users like what they find on your site with their friends)
- Activity Feed (Display your application's and friends activity)
- Friend Pile (Display your application's friends)
- Recommendations (Display your recommendations based on your current url)
Some Examples of the newest features are:
- //Like Button
- $facebook->like(); // => standard like button
- 'font' => 'veranda',
- 'layout' => 'button_count',
- 'action' => 'recommend',
- 'colorscheme' => 'dark'
- )); // => customized like button
- //Activity Feed
- $facebook->activity(); // => app activity widget
- 'colorscheme' => 'dark',
- 'bordercolor' => 'black',
- 'font' => 'arial',
- 'width' => '250',
- 'height' => '200',
- 'header' => 'false',
- 'recommendations' => 'true'
- )); // => customzied activity widget including recommendations
- //Recommendations Widget
- $facebook->recommendations(); // => recommendations of current page
- 'colorscheme' => 'dark',
- 'bordercolor' => 'black',
- 'width' => '250',
- 'height' => '200',
- 'header' => 'false'
- )); // => customized recommendations widget
- //Friend Pile Widget
- $facebook->friendpile(); // => standard friend pile
- 'width' => 200,
- 'numrows' => 3
- )); // => customized friend pile
Feature Improvements
Along with the newest Helper features there is an feature enhancement as well.- FacebookHelper::logout() Now accepts CakePHP array urls as valid redirect options
Example:
- //Normal logout
- 'redirect' => 'users/logout'
- ));
- //Same as above
- ));
1.x to 2.x Migration Guide
There are a few changes you should be aware of before upgrading your application to the newest version 2.0.- FacebookHelper::loader() is now deprecated. Remove it from your layout.
- ConnectComponent::getUserInfo() is no longer available, use ConnectComponent::user() instead.
- config/facebook.php needs to be updated.
- FacebookHelper::init() no longer takes in extended permission options, remove any of these extended options from your $facebook->init() call in your layout.
- FacebookApi class is now FB for short use App::import('Lib','Facebook.FB'); for easy access to the full Facebook API.
New Configuration File Example:
- app/config/facebook.php
- 'appId' => 'YOUR_APP_ID',
- 'apiKey' => 'YOUR_API_KEY',
- 'secret' => 'YOUR_SECRET',
- 'cookie' => true,
- )
- );
New ConnectComponent::user() Examples:
- function beforeFilter(){
- //Get all the details on the facebook user
- $this->set('facebookUser', $this->Connect->user());
- //retrieve only the id from the facebook user
- $this->set('facebook_id', $this->Connect->user('id'));
- //retrieve only the email from the facebook user
- $this->set('facebook_email', $this->Connect->user('email'));
- }
New Layout Example:
[geshi=html] = $facebook->html(); ?> Facebook Plugin Example = $facebook->init(); ?>