PHP code example of ryodevz / simple-auth

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

    

ryodevz / simple-auth example snippets




return [
    'auth' => [
        'login' => [
            'base' => '/login.php',
            'fields' => [
                'btnLogin' => 'btn-login',
                'username' => 'username',
                'password' => 'password'
            ],
            'redirect' => [
                'success' => '/',
            ],
            'password_hash' => false
        ]
    ],
    'database' => [
        'host' => 'localhost',
        'username' => 'root',
        'password' => null,
        'database' => 'root',
        'users_table' => [
            'table' => 'users',
            'username' => 'email',
            'password' => 'password',
        ]
    ],
];

Auth::sessionStart()



use Ryodevz\Auth;

th::login();

if (Auth::user()->username) {
    return header('location: /');
}