PHP code example of pperon / vbauth

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

    

pperon / vbauth example snippets


'providers' => array(
		...
		...
		'Pperon\Vbauth\VbauthServiceProvider',
),

'aliases' => array(
		...
		...
		'Vbauth'		  => 'Pperon\Vbauth\Facades\Vbauth',
),

if(Vbauth::isAdmin()){
	// Show administrator page
	View::make('admin.index');
} elseif (Vbauth::isLoggedin()) {
	// Show user page
	View::make('user.index');	
} else {
	// Show guest page
	View::make('guest.index');
}

if(Vbauth::isLoggedin()) {
    $user_id  = Vbauth::get('userid');
    $username = Vbauth::get('username');
    $email    = Vbauth::get('email');
}


if(Vbauth::is('moderator')) {
    View::make('moderator.panel');
}

Redirect::to(Vbauth::logoutURL());

$user_id = 8;
$user = Vbauth::getUserInfo($user_id);
echo $user['email']; // displays email for user with user_id = 8
echo $user['username']; // show username

  'db_connection' => 'vbconn', // vbconn is the connection name in database.php

$user_id = 8;
$user = Vbauth::getUserInfo($user_id);
echo $user['email']; // displays email for user with user_id = 8