PHP code example of michaelthedev / superban

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

    

michaelthedev / superban example snippets


'providers' => [
    // ...
    Michaelthedev\Superban\SuperbanServiceProvider::class,
],

php artisan vendor:publish --provider="Michaelthedev\Superban\SuperbanServiceProvider"

return [
    'cache_driver' => env('SUPERBAN_CACHE_DRIVER', env('CACHE_DRIVER', 'file')),
    'requests_before_ban' => env('SUPERBAN_REQUESTS_BEFORE_BAN', 200),
    'ban_after' => env('SUPERBAN_BAN_AFTER', 2),
    'ban_length' => env('SUPERBAN_BAN_LENGTH', 1440),
];

Route::middleware(['superban:200,2,1440'])->group(function () {
   Route::post('/thisroute', function () {
       // ...
   });

   Route::post('anotherroute', function () {
       // ...
   });
});