Download the PHP package webtechnick/cakephp-facebook-plugin without Composer

On this page you can find all versions of the php package webtechnick/cakephp-facebook-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cakephp-facebook-plugin

Facebook Plugin

The purpose of the Facebook plugin is to provide a seamless way to connect your cakePHP app to everyone's favorite social networking site -- Facebook. The goal for this plugin is to not only provide extremely useful dynamic features but to also provide a complete interface to the Facebook API.

Changelog

About Plugin

Feature List

Install and Setup

Once installed, if you wish to use any other features other than the share button you'll need to get an api_key and secret for your application.

Usage

You can use all or some of the Facebook plugin as you see fit. At the very least you will probably want to use the Facebook Helper

public $helpers = array('Facebook.Facebook');

If all you want to use is the share feature of the Facebook plugin you're all done.

$this->Facebook->share('http://www.example.com/url_to_share'); //(default is the current page).

Nothing else is required for the Facebook share feature. Hoever, to use the more advanced features you'll need to prepare your page a little to handle the fbxml tags.

Edit your Layout to take advantage of advanced facebook features

  1. In your layout it's highly suggest you replace your <html> tag with `` This is required for some of the facebook features to work in IE.
  2. At the bottom of the page include `` To load the facebook javascript api to scan your page for fbxml and replace them with various dynamic content.

Example layout

    <head>
        <title></title>
    </head>
    <body>

    </body>

</html>

Authentication (Facebook Connect/Graph System):

Despite the name, the Facebook Connect component takes immediate advantage of the new powerful Facebook Graph API http://developers.facebook.com/docs/api

To use this feature you will first need to update your facebook application with the connect url of your application's url. This is done on the facebook application settings. http://www.facebook.com/developers/apps.php Now all you need to do is add the Facebook.Connect component to your app_controller.

public $components = array('Facebook.Connect');

That's it. You're now ready to accept facebook authentication.

Login/Logout buttons

Creates a login button:

Create a login button that asks for extended permissions (http://developers.facebook.com/docs/authentication/permissions)

Create a logout button:

Each button has multiple options, review the API to see all available options http://docs.webtechnick.com/facebook/classes/FacebookHelper.html

Registration Form

Create a registration form with default fields and width. Default is posting to self.

Create a custom registration form.

Processing Registration Data.

To access the registartion data posted by your registration user, use the convienient ConnectComponent::registrationData() function.

if($user = $this->Connect->registrationData()){
    print_r($user);
}

Use the data in $user to finish the registration process on your own (save a new user, find/update the user, etc..)

CakePHP Auth + Facebook.Connect

Facebook.Connect will play nice with a variety of Authentication systems. It has nearly seamless integration with CakePHP AuthComponent.

note Since the CakePHP 2.0 AuthComponent revamp, ConnectComponent doesn't have the introspection available anymore. It is necessary to tell Connect what model you store your users data in for the automagic to work like so:

//Example AppController.php components settup with FacebookConnect
public $components = array('Session',
            'Auth' => array(
                'authenticate' => array(
                    'Form' => array(
                        'fields' => array('username' => 'email')
                    )
                ),
                'authorize' => 'Controller'
            ),
            'Facebook.Connect' => array('model' => 'User')
        );

To integrate with CakePHP Auth, you'll need to alter your users table (or whatever table your Auth component uses) and add a new field -> facebook_id.

ALTER TABLE `users` ADD `facebook_id` BIGINT(20) UNSIGNED NOT NULL

Since you already have an authentication system, the logout step will need to also log out the user from your authentication system. You do this by passing a redirect to $facebook->logout() to your system's logout authentication action.

In this case you should set the label or img option if you want the logout button to be displayed.

or

This will log out of the facebook authentication and then redirect to your authentication logout for you to finish the logout.

Facebook Auth Callbacks

There are three callbacks available to use, each are defined in the controller and are optional to use.

Advanced Helper Feature Examples

Facebook API

You can access the Facebook Api from anywhere in your app. You'll need to include the Api first

App::uses('FB', 'Facebook.Lib');

Then you can instanciate it or, if you're running PHP 5.3.x you can make static calls on it.

PHP version 5.2.x

    $Facebook = new FB();
    $Facebook->api('/me');

PHP 5.3.x

    FB::api('/me');

Internationalization

You can set the locale of the plugin through the helper declaration or through the config/facebook.php configuration file (see top of document).

public $helpers = array('Facebook.Facebook' => array('locale' => 'en_US'));

Facebook locales: http://developers.facebook.com/docs/internationalization/

Read the Docs

I encourage you to read the documentation and API for this plugin to see all the features and options for each feature. The API is here: http://docs.webtechnick.com/facebook/


All versions of cakephp-facebook-plugin with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
composer/installers Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package webtechnick/cakephp-facebook-plugin contains the following files

Loading the files please wait ....