PHP code example of wscore / auth

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

    

wscore / auth example snippets


$auth = new Auth(new UserProvider);

if ($auth->login($id, $pw)) {
    echo 'login success!';
}

$auth->isLogin();

$user = $auth->getLoginUser(); // login user entity returned by UserProvider's getUserInfo() method.
$mail = $auth->getLoginId(); // get login user's id. maybe an email? 

$auth->forceLogin($id);

$auth->isLoginBy(Auth::BY_FORCED); // check for login method. 

$auth = new Auth(...);
$auth->setRememberMe(new MyRememberMe());

$auth->login($id, $pw, true);