PHP code example of skim / auth

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

    

skim / auth example snippets


use Skim\Auth\AuthService;

// Obtain the authentication service from the app DI container
$auth = app()->make(auth_service::class);

// Or retrieve via the bound shorthand
$auth = app('auth');

// Attempt credentials login
try {
    $session = $auth->attempt([
        'email'    => '[email protected]',
        'password' => 'secret-password'
    ]);
    
    // User is now authenticated
    $user = $auth->user();
} catch (\Exception $e) {
    // Handle invalid credentials
}

// routes/web.php or inside boot()
$app->router->get('/dashboard', [dashboard_controller::class, 'show'])
    ->middleware(\Skim\Auth\Middleware\AuthMiddleware::class);

// Redirect to Github
return response()->redirect(app('auth')->oauth('github')->get_redirect_url());
bash
php skim migrate:status
php skim migrate