PHP code example of jorge / cakephp-facebook
1. Go to this page and download the library: Download jorge/cakephp-facebook library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jorge / cakephp-facebook example snippets
" "akkaweb/cakephp-facebook": "dev-master"
}
Plugin::load('AkkaFacebook', ['bootstrap' => false, 'routes' => true]);
public function initialize(){
parent::initialize();
$this->loadComponent('AkkaFacebook.Graph', [
'app_id' => 'your-fb-app-id',
'app_secret' => 'your-fb-app-secret',
'app_scope' => 'email', // https://developers.facebook.com/docs/facebook-login/permissions/v2.3
'enable_create' => true,
'redirect_url' => '', //ie. Router::url(['controller' => 'Users', 'action' => 'login'], TRUE),
'post_login_redirect' => '' //ie. Router::url(['controller' => 'Users', 'action' => 'account'], TRUE)
// 'user_columns' => ['first_name' => 'fname', 'last_name' => 'lname', 'username' => 'uname', 'password' => 'pass', 'extra_columns' => ['active' => 1]] //not
sudo php composer.phar update
`
Optional Settings Array
* id -> Link id
* class -> Link class
* title -> Link title
* style -> Any html style
* label -> Hyperlink text
` echo $this->Facebook->loginLink($options = []);
`
Default Options
* 'auto-logout-link' => false,
* 'max-rows' => 1,
* 'onlogin' => null,
* 'size' => 'small',
* 'show-faces' => false,
* 'default-audience' => 'friends'
` echo $this->Facebook->loginButton($options = []);
`
Default Options
* 'action' => 'like', // like, recommend
* 'share' => true,
* 'width' => 450,
* 'show-faces' => true,
* 'layout' => 'standard' // standard, box_count, button_count, button
` echo $this->Facebook->likeButton($options = []);
`
Default Options
* 'layout' => 'button_count' // button_count/box_count/button/icon_link/icon/link
` echo $this->Facebook->shareButton($options = []);
`
Default Options
* 'width' => 50,
* 'height' => 30,
* 'colorscheme' => dark
` echo $this->Facebook->sendButton($options = []);
`
Default Options
* 'width' => 300,
* 'height' => 100,
* 'colorscheme' => 'light',
* 'layout' => 'standard',
* 'show-faces' => false,
* 'kid-directed-site' => false
` echo $this->Facebook->followButton($options = []);
`
Default Options
* 'colorscheme' => light, // light/dark
* 'mobile' => 'Auto-detected',
* 'num-posts' => 10,
* 'order-by' => 'social', // social/reverse_time/time
* 'width' => 550
` echo $this->Facebook->comments($options = []);
`
Default Options
* 'width' => 500
` echo $this->Facebook->embeddedPosts($options = []);
`
Default Options
* 'href' => ''
* 'width' => 500
` echo $this->Facebook->embeddedVideo($options = []);
`
Default Options
* 'href' => 'https://www.facebook.com/facebook',
* 'height' => 300,
* 'hide-cover' => false,
* 'show-facepile' => true,
* 'show-posts' => false,
* 'width' => 500
` echo $this->Facebook->page($options = []);
echo $this->Facebook->initJsSDK();