2017 © Pedro Peláez
 

library phalcon-social

a phalcon component to implement social logins

image

dev-ratna/phalcon-social

a phalcon component to implement social logins

  • Tuesday, May 9, 2017
  • by devcodes
  • Repository
  • 2 Watchers
  • 6 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 50 % Grown

The README.md

Phalcon Social

Social Login Wrapper for Phalcon (Based on Laravel's Socialite), (*1)

Installation

composer require dev-ratna/phalcon-social

Configration

the wrapper by deafault searches for social key in the main config file., (*2)

the config should use keys facebook, google or depending on the alias of the provider., (*3)

'social' => [
  'facebook' => [
        'client_id' => 'client-id-here',
        'client_secret' => 'client-secret-here',
        'redirect_uri' => 'url/to/redirect'
    ],
    'google' => [
        'client_id' => 'example-id',
        'client_secret' => 'example-secret',
        'redirect_uri' => 'url/to/redirect'
    ]
  ]

Usage

The Service, (*4)

use PhalconSocial\PhalconSocial;

$di->setShared('socialLogin', function(){
    $socialLogin = new SocialLogin();
    return $socialLogin;

});

The routes, (*5)

$router->add('/social/oauth/redirect', [
    'controller' => 'controller',
    'action' => 'redirect'
]);

$router->add('/social/oauth/login', [
    'controller' => 'controller',
    'action' => 'login'
]);

In the Controller, (*6)

<?php

namespace Namespace\Controllers;


class Controller extends ControllerBase
{

    public function redirectAction()
    {
        $this->socialLogin->useProvider('google')->redirect();
    }

    public function loginAction()
    {
        $user = $this->socialLogin->useProvider('google')->authorize()->user();
    }
}

Adding your own providers

In works., (*7)

Currently the package only supports google and facebook, more are to come soon.

The Versions

09/05 2017

dev-master

9999999-dev

a phalcon component to implement social logins

  Sources   Download

MIT

The Requires

 

by Dev Ratna Upadhyaya

socialite phalcon social-login phalcon-social