dev-master
9999999-devThen (^_^) ...
The Requires
- php >=5.4.0
- illuminate/support 4.x
by Tutik Alexsandr
Wallogit.com
2017 © Pedro Peláez
Then (^_^) ...
Laravel Socialist Package, (*1)
You should install this package through Composer., (*2)
Edit your project's composer.json file to require tutik/socialist., (*3)
"require": {
"laravel/framework": "4.x",
"tutik/socialist": "dev-master"
},
"minimum-stability" : "dev"
Next, update Composer from the Terminal:
composer update, (*4)
Once this operation completes, the final step is to add the service provider. Open app/config/app.php, and add a new item to the providers array., (*5)
'Tutik\Socialist\SocialistServiceProvider',, (*6)
Create config file in base folder app, (*7)
/app/config/api/socialist.php, (*8)
return [
'vk' => [
'app_id' => '',
'app_key' => '',
'redirect_url' => 'http://site/socialist',
],
'mailru' => [
'app_id' => ,
'app_key_private' => '',
'app_key' => '',
'redirect_url' => 'http://site/socialist',
],
'fb' => [
'app_id' => '',
'app_key' => '',
'redirect_url' => 'http://site/socialist',
],
];
Create a controller and use, (*9)
<?php use \Tutik\Socialist\Socialist;
// VKontakte
$response = Socialist::factory('vk')->api('users.get',[
'users_id' => '100500',
'access_token' => <access_token>,
]);
$response = array_shift($data['response']);
// MailRu
$mail = Socialist::factory('mailru');
if ($uid = $mail->isAuth()) {
$response = $mail->api('users.getInfo', array('uids' => $uid));
$response = array_shift($response); // User Data
}
// Facebook
$facebook = Socialist::factory('facebook'); // or alias fb
$user = $facebook->getUser();
if ($user) {
try {
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
$user = null;
}
}
// @TODO Google+
Then (^_^) ...