bonbon1702 / facebooksdk
There is no license information available for the latest version (dev-master) of this package.
Easy way to use facebook SDK
dev-master
2014-12-04 02:21 UTC
Requires
- php: >=5.3.0
- facebook/php-sdk-v4: 4.0.*
- guzzlehttp/guzzle: *
- illuminate/config: ~4|~5
- illuminate/routing: ~4|~5
- illuminate/session: ~4|~5
- illuminate/support: ~4|~5
This package is not auto-updated.
Last update: 2024-11-19 04:49:12 UTC
README
Installation
- In composer.json, add require:
"bonbon1702/facebooksdk": "dev-master"
- Run
Composer update
-
In app/config/app.php:
-Add providers
'bonbon1702\Facebook\FbServiceProvider',
-Add aliases
'Fb' => 'bonbon1702\Facebook\Facades\Fb',
- Publish the configuration:
php artisan config:publish bonbon1702/facebooksdk
- After that, you must config app_id and app_secret in
app/config/packages/bonbon1702/facebooksdk/config.php
return array( 'app_id' => '', 'app_secret' => '', 'redirect_url' => url('facebook/callback'), 'scope' => array( 'publish_actions', ) );
Usage
-Log in to Facebook
Fb::authenticate();
-Check login(return boolean)
Fb::check()
-Get user profile
Fb::getProfile()->asArray();
-Get user profile picture
Fb::getUserProfilePicture($type)->asArray();($type is square,small,normal,large);
-Publish posts to facebook
Fb::postToTimeLine($message, $link);
Example
Route::group(['prefix' => 'facebook'], function () { Route::get('connect', function () { return Fb::authenticate(); }); Route::get('callback', function () { $check = Fb::check(); if($check) { $profile = Fb::getProfile(); dd($profile); } }); });