PHP code example of tiup / tiupsdk-laravel

1. Go to this page and download the library: Download tiup/tiupsdk-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tiup / tiupsdk-laravel example snippets


Tiup\LaravelTiupSdk\LaravelTiupSdkServiceProvider::class,

'Tiup' => Tiup\LaravelTiupSdk\TiupFacade::class,
 artisan serve


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);
});
shell
php artisan vendor:publish  --provider="Tiup\LaravelTiupSdk\LaravelTiupSdkServiceProvider"