New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

tiup/tiupsdk-laravel

laravel tiup sdk
68
Install
composer require tiup/tiupsdk-laravel
Latest Version:0.4
License:TiUP
Last Updated:Jul 19, 2017
Links: GitHub  ·  Packagist
Maintainer: tiup

TiUP SDK for Laravel

Installation

composer require tiup/tiupsdk-laravel 
配置

修改 config/app.php

在providers中增加

Tiup\LaravelTiupSdk\LaravelTiupSdkServiceProvider::class,

在 aliases 中增加

'Tiup' => Tiup\LaravelTiupSdk\TiupFacade::class,
运行下面复制配置文件到 config目录。
php artisan vendor:publish  --provider="Tiup\LaravelTiupSdk\LaravelTiupSdkServiceProvider"
.env 增加以下配置
TIUP_CLIENT_ID=client_id
TIUP_CLIENT_SECRET=client_secret
TIUP_AUTH_HOST=https://test.tiup.cn/
TIUP_API_HOST=https://test.tiup.cn/

运行 php artisan serve 启动即可

应用首页 http://127.0.0.1:8000

登录回调 http://127.0.0.1:8000/oauth/callback

代码示例


Route::get('/', function () {
	 //获取登录地址
    $url = Tiup::getAuthorizationUrl('http://127.0.0.1:8000/oauth/callback');
    return redirect($url);
});


Route::get('/oauth/callback', function () {
	//登录成功回调,获取用户信息
    $token = \Tiup::getAccessToken();
    $userinfo = \Tiup::me($token);
    dd($userinfo);
});

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

648,266,899 9,701
laravel/framework

The Laravel Framework.

604,216,237 34,982
laravel/tinker

Powerful REPL for the Laravel framework.

512,508,631 7,443
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

429,221,767 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

407,699,310 4,663

Version History

Version Released License
0.4 TiUP
0.3 TiUP
0.2 TiUP
0.1