PHP code example of springlee / yc-user-center

1. Go to this page and download the library: Download springlee/yc-user-center 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/ */

    

springlee / yc-user-center example snippets



Yc\UserCenter\Authorization;


$config = [
    'app_key' => 'zlj_dt5tyRElS9yy9vAafWoarHjeZ',//必填
    'app_secret' => 'vywE8L6JfkZcKksBqAlVJL4B8oNUG8',//必填
    //redis配置
    'redis'=>[
        'host'=>'127.0.0.1',
        'port'=>'6379'
    ]
];

$app = new Authorization($config);




namespace App\Http\Controllers;
use Yc\UserCenter\Authorization;
class HomeController extends Controller
{

    public function code(Authorization $auth)
    {
        $ret= $auth->getCode();
        
        var_dump($ret);
    }

    public function user()
    {
        $app = app('authorization');
        $ret = $app->setToken('')->getUser();
        var_dump($ret);
    }
}

$xslt
php artisan vendor:publish --provider="Yc\UserCenter\ServiceProvider" --tag="config"