pitchanon / facebook-connect
A vendor facebook connect package
Installs: 4 280
Dependents: 1
Suggesters: 0
Security: 0
Stars: 27
Watchers: 5
Forks: 11
Open Issues: 3
Requires
- php: >=5.3.0
- illuminate/support: 4.x
This package is auto-updated.
Last update: 2024-11-07 15:54:44 UTC
README
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
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