PHP code example of webman-tech / auth

1. Go to this page and download the library: Download webman-tech/auth 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/ */

    

webman-tech / auth example snippets


use WebmanTech\Auth\Auth;

$guard = Auth::guard(); // 获取默认的 guard
$guard = Auth::guard('admin'); // 获取指定名称的 guard

$guard->login($user); // 用户登录
$guard->logout(); // 用户退出登录
$guard->getId(); // 获取当前登录用户的 id
$guard->getUser(); // 获取当前登录用户的实例
$guard->isGuest(); // 判断当前用户是否为游客