PHP code example of yeonik / login-defense

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

    

yeonik / login-defense example snippets


use LoginDefense\Core\LoginGuard;

// 1. Before checking credentials, ask the guard what to do.
$decision = $guard->check($email, $ip, $request->captchaToken());

if ($decision->isLockedOut()) {
    return response('Too many attempts', 429)
        ->withHeader('Retry-After', (string) $decision->retryAfter);
}

if ($decision->der
}

Route::post('/login', LoginController::class)
    ->middleware(\LoginDefense\Bridge\Laravel\ProtectsLogin::class);
bash
php artisan vendor:publish --tag=login-defense-config