philo/laravel5-facebook
最新稳定版本:v1.0.1
Composer 安装命令:
composer require philo/laravel5-facebook
包简介
Laravel 5 - Facebook SDK v4 wrapper.
README 文档
README
Installation
The package can be installed via Composer by requiring the "philo/laravel5-facebook": "1.0.*" package in your project's composer.json.
{
"require": {
"laravel/framework": "~5.0*",
"philo/laravel5-facebook": "1.0.*"
},
"minimum-stability": "dev"
}
Next you need to add the service provider to app/config/app.php
'providers' => array(
// ...
'Philo\Laravel5Facebook\Laravel5FacebookServiceProvider',
)
And do the same for the alias:
'aliases' => array( // ... 'Facebook' => 'Philo\Laravel5Facebook\Facades\Facebook', )
Add Facebook to services
Laravel 5 has a new file that contains all third party services (app/config/services.php). Add your client_id and client_secret.
<?php return [ /* |-------------------------------------------------------------------------- | Third Party Services |-------------------------------------------------------------------------- | | This file is for storing the credentials for third party services such | as Stripe, Mailgun, Mandrill, and others. This file provides a sane | default location for this type of information, allowing packages | to have a conventional place to find your various credentials. | */ 'facebook' => [ 'client_id' => '1234567891234612', 'client_secret' => 'a837f07gjsoxya721964120z7dkgr', ], ];
Usage
// Create session $token = '<facebook access token>'; Facebook::createSession($token); // Request $user = Facebook::request('/me')->getGraphObject(GraphUser::className());
I've added a couple shortcuts for the most common graph objects.
$user = Facebook::user(); $location = Facebook::location(); $albums = Facebook::albums(); $album = Facebook::album(1234567890);
If you would like to access the FacebookSession object, call the getSession method.
$session = Facebook::getSession(); $info = $session->getSessionInfo();
统计信息
- 总下载量: 787
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2014-11-18