Pitchanon / Laravel4-FacebookConnect by popphoenix

A vendor facebook connect package
4,279
28
5
Package Data
Maintainer Username: popphoenix
Maintainer Contact: Pitchanon.d@gmail.com (Pitchanon D.)
Package Create Date: 2013-10-29
Package Last Update: 2014-09-17
Home Page: https://github.com/Pitchanon/Laravel4-FacebookConnect
Language: PHP
License: GNU General Public License (GPL)
Last Refreshed: 2024-04-16 15:01:21
Package Statistics
Total Downloads: 4,279
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 28
Total Watchers: 5
Total Forks: 11
Total Open Issues: 3

Facebook Connect for Laravel 4

Facebook Connect is a useful to create app facebook and get testing request.

Installation

To get the lastest version of Theme simply require it in your composer.json file.

"require": {

    "pitchanon/facebook-connect": "dev-master"

}

You'll then need to run composer install or composer update to download it and have the autoloader updated

or

You can install this bundle by running the following CLI command.

$ php artisan bundle:install Laravel4-FacebookConnect

Once Theme is installed you need to register the service provider with the application. Open up app/config/app.php and find the providers key.

'providers' => array(

    'Pitchanon\FacebookConnect\FacebookConnectServiceProvider'

)

Usage

Getting Started with the Facebook SDK for PHP.

In Controller.

Getting Started

Use a single object of a class throughout the lifetime of an application.

// Use a single object of a class throughout the lifetime of an application.
$application = array(
    'appId' => 'YOUR_APP_ID',
    'secret' => 'YOUR_APP_SECRET'
    );
$permissions = 'publish_stream';
$url_app = 'http://laravel-test.local/';

// getInstance
FacebookConnect::getFacebook($application);

getUser


$getUser = FacebookConnect::getUser($permissions, $url_app); // Return facebook User data

var_dump($getUser);

Post to wall

// post to wall facebook.
$message = array(
    'link'    => 'http://laravel-test.local/',
    'message' => 'test message',
    'picture'   => 'http://laravel-test.local/test.gif',
    'name'    => 'test Title',
    'description' => 'test description',
    'access_token' => $getUser['access_token'] // form FacebookConnect::getUser();
    );

FacebookConnect::postToFacebook($message, 'feed'); // return feed id 1330355140_102030093014XXXXX

Check user likes the page in Facebook

// Check user likes the page in Facebook.
$page_id = 'FACEBOOK_PAGE_ID';
$user_id = $getUser['user_profile']['id']; // form FacebookConnect::getUser();

$check_like_fan_page = FacebookConnect::getUserLikePage($page_id, $user_id);

if (!empty($check_like_fan_page) && array_key_exists('uid', $check_like_fan_page[0]) && $check_like_fan_page[0]['uid'] == $user_id) {
    echo 'LIKE';
else {
    echo 'DONT LIKE';
}

Demo

Facebook application.

NOTE: Permission demo publish_stream, read_stream, manage_pages, email, user_likes, user_photos.

Support or Contact

If you have some problem, Contact Pitchanon.d@gmail.com

http://www.playdn.com/