2017 © Pedro Peláez
 

library fashionguide

image

flash662/fashionguide

  • Thursday, May 25, 2017
  • by flash662
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

FashionGuide Oauth2 PHP SDK

該套件提供 FashionGuide Oauth2 取得資料, (*1)

版本需求

  • PHP 5.6(含)以上
  • Laravel 5.3(含)以上

安裝

  1. 透過 composer 安裝

composer require fashionguide/oauth2, (*2)

  1. 加入 provider, (*3)

    config/app.php, (*4)

    'providers' => [
        \FashionGuide\Oauth2\ServiceProvider::class,
    ]
    
  2. 加入 alias, (*5)

    config/app.php, (*6)

    'aliases' => [
       'FG' => \FashionGuide\Oauth2\Facade::class,
    ]
    

Config

預設於 .env 取得, (*7)

.env, (*8)

FG_CLIENT_ID=1
FG_CLIENT_SECRET=ChfjlvqDVlpKzrKf0x7vo0h05jYkMKhs61RTGlYZ
FG_REDIRECT_URI=http://localhost:8000/callback

或是 publish config 自己定義 config, (*9)

php artisan vendor:publish --provider="FashionGuide\Oauth2\Providers\ServiceProvider", (*10)

API Document

// todo, (*11)

Usage

取得 user 資料

  1. 先取得登入網址
<?php

use \FashionGuide\Oauth2\FashionGuide;

public function index(FashionGuide $fg)
{
    $fg->getLoginUrl();
    return view('view', ['loginUrl' => $fg]);
} 

  1. 設定 callback url 取得 authorization code,並且透過 sdk 取得資料
<?php

use \FashionGuide\Oauth2\FashionGuide;
use FashionGuide\Oauth2\Exceptions\RequestException;

public function callback(FashionGuide $fg)
{
    try {
        $user = $fg->get('/member/me');
    } catch (RequestException $e) {

    }
}

The Versions

25/05 2017

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

by Ivan Wu

11/05 2017

0.1.2

0.1.2.0

  Sources   Download

The Requires

 

by Ivan Wu

11/05 2017

0.1.1

0.1.1.0

  Sources   Download

The Requires

 

by Ivan Wu

11/05 2017

0.1.0

0.1.0.0

  Sources   Download

The Requires

 

by Ivan Wu