sramitroy/social

implementation of social authentication's specification for php

1.0.0 2021-04-25 10:25 UTC

This package is auto-updated.

Last update: 2025-05-29 01:34:55 UTC


README

Implementation of Social Authentication for php

Install

Via Composer

$ composer require sramitroy/social

Usage

// FIRST STEP 
  use Soft\Google;
 
  $gObject = new Google([
  	 'client_id'=>'YOUR_CLIENT_ID',
  	 'redirect_uri'=>'YOUR_REDIRECT_URL',
  	 'client_secret'=>'YOUR_CLIENT_SECREAT',
  ]);
  $url= $gObject->LogInUrl(); //return Google Login URL
// SECOND STEP 
// DEFINE THESE SCRIPTS ONTO CALL BACK FILE
  use Soft\Google;
 
  $gObject = new Google([
  	 'client_id'=>'YOUR_CLIENT_ID',
  	 'redirect_uri'=>'YOUR_REDIRECT_URL',
  	 'client_secret'=>'YOUR_CLIENT_SECREAT',
  ]);

  $AccessToken = $gObject->AccessToken($_GET['code']);

  $profile     = $gObject->UserProfile(
                     $AccessToken['access_token'],
                     ['name','email','gender,id','picture','verified_email']
                 ); // return google profile information

Testing

$ phpunit

License

The MIT License (MIT). Please see License File for more information.