socialh4ck/facebook
Composer 安装命令:
composer require socialh4ck/facebook
包简介
Facebook PHP SDK Package for Laravel 4
README 文档
README
Facebook PHP SDK for Laravel
Add socialh4ck/facebook to composer.json.
"socialh4ck/facebook": "dev-master"
Run composer update to pull down the latest version of Facebook.
Now open up app/config/app.php and add the service provider to your providers array.
'providers' => array(
'Socialh4ck\Facebook\FacebookServiceProvider',
)
Now add the alias.
'aliases' => array(
'Facebook' => 'Socialh4ck\Facebook\FacebookFacade',
)
Configuration
Run php artisan config:publish socialh4ck/facebook and modify the config file with your own informations.
- AppId => If you donot have appId then get it from facebook developer apps.
- Secret => Its come with appId.
- Redirect => Specify redirect url after logged in with facebook.
- Logout => When somebody logout from your site, it redirects to logout url.
- Scope => These are permission you want from your users.
Examples
-
Get Login Url with your credentials and scope.
Route::get('/', function() { return Facebook::loginUrl(); }); -
Get User Id
Route::get('/', function() { return Facebook::getUser(); }); -
Use facebook API
Route::get('/', function() { $profile = Facebook::api('/me?fields=id,name'); }); -
Get Logout Url
Route::get('/', function() { return Facebook::logoutUrl(); }); -
FQL
Route::get('/', function() { return Facebook::api(array( 'method' => 'fql.query', 'query' => "SELECT uid, sex, username, birthday, education, work FROM user WHERE uid = me()", )); });
统计信息
- 总下载量: 208
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2014-07-12