PHP code example of sinevia / php-library-throttle-plugin

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

    

sinevia / php-library-throttle-plugin example snippets


\Sinevia\Plugins\ThrottlePlugin::configure([
   'pdo' => \DB::getPdo()
]);

$userIp = \Sinevia\Plugins\ThrottlePlugin::getCurrentUserIp();

$mayAttempt = \Sinevia\Plugins\ThrottlePlugin::mayAttempt('LoginForm', $userIp, 6, 10 * 60); // 6 attempts in 10 minutes

if ($mayAttempt == false) {
   $message = 'You have passed the maximum allowed authentication attempts.';
   $message .= ' Please, check your password and try again in 10 minutes.';
   return redirect()->back()->withErrors($message)->withInput();
}
json
   "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/Sinevia/php-library-throttle-plugin.git"
        }
    ],
    "