2017 © Pedro Peláez
 

library socialist

Then (^_^) ...

image

tutik/socialist

Then (^_^) ...

  • Thursday, December 19, 2013
  • by sanchezzzhak
  • Repository
  • 2 Watchers
  • 0 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Socialist

Laravel Socialist Package, (*1)

Installation

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)

Usage

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+


The Versions

19/12 2013

dev-master

9999999-dev

Then (^_^) ...

  Sources   Download

The Requires

 

by Tutik Alexsandr