PHP code example of mggflow / lv-msvc-auth

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

    

mggflow / lv-msvc-auth example snippets


/**
 * Auth database settings
 */
'auth' => [
    'driver' => 'mysql',
    'url' => env('LV_MSVC_AUTH_DATABASE_URL', null),
    'host' => env('LV_MSVC_AUTH_DB_HOST', '127.0.0.1'),
    'port' => env('LV_MSVC_AUTH_DB_PORT', '3306'),
    'database' => env('LV_MSVC_AUTH_DB_DATABASE', 'auth'),
    'username' => env('LV_MSVC_AUTH_DB_USERNAME', 'root'),
    'password' => env('LV_MSVC_AUTH_DB_PASSWORD', ''),
    'unix_socket' => env('LV_MSVC_AUTH_DB_SOCKET', ''),
    'charset' => 'utf8mb4',
    'collation' => 'utf8mb4_unicode_ci',
    'prefix' => '',
    'prefix_indexes' => true,
    'strict' => true,
    'engine' => null,
    'options' => extension_loaded('pdo_mysql') ? array_filter([
        PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
    ]) : [],
],

$password = $request->input('password', false);
$username = $request->input('username', false);
$email = $request->input('email', false);
$token = $request->header($this->authHeaderName, $request->input('token', false));
        
$this->authenticateFacade = new Authenticate();
$authenticateFacade->auth($password, $username, $email, $token);

// object|null
$currentUser = $authenticateFacade->getCurrentUser();