PHP code example of pingpong / facebook
1. Go to this page and download the library: Download pingpong/facebook library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pingpong / facebook example snippets
'Pingpong\Facebook\FacebookServiceProvider',
'Facebook' => 'Pingpong\Facebook\Facades\Facebook',
return array(
'app_id' => '',
'app_secret' => '',
'redirect_url' => url('facebook/callback'),
'scope' => array(
'publish_actions',
'email'
)
);
Facebook::getLoginUrl();
$scope = array('email');
Facebook::getLoginUrl($scope);
Facebook::authenticate();
$scope = array('email');
Facebook::authenticate($scope);
$version = 'the-version';
$scope = array('email');
Facebook::authenticate($scope, $version);
Facebook::displayAsPopup();
return Facebook::authenticate($scope, $version);
Facebook::getProfile();
Facebook::getCallback();
Facebook::destroy();
// or
Facebook::logout();
Facebook::api($method, $path, $parameters, $version);
Facebook::api('GET', '/me');
Facebook::api('POST', '/me/feed', $parameters);
Facebook::api('PUT', '/path', $parameters);
Facebook::api('PATCH', '/path', $parameters);
Facebook::api('DELETE', '/path/to', $parameters);
Facebook::get('/path', $parameters);
Facebook::post('/path', $parameters);
Facebook::put('/path', $parameters);
Facebook::patch('/me', $parameters);
Facebook::delete('/me', $parameters);
Route::group(['prefix' => 'facebook'], function ()
{
Route::get('connect', function ()
{
return Facebook::authenticate();
});
Route::get('callback', function ()
{
$callback = Facebook::getCallback();
if($callback)
{
$profile = Facebook::getProfile();
dd($profile);
}
dd($callback);
});
});
php artisan vendor:publish --provider="Pingpong\Facebook\FacebookServiceProvider"