PHP code example of zeevx / superban

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

    

zeevx / superban example snippets


return [
/**
     * Key used in cache
     * The default is ip_address, you can use either: ip_address or email or user_id
     *
     */
    'key' => 'ip_address',

    /**
     * The cache to be used,
     * The default cache in config/cache.php is used if empty.
     */
    'cache' => 'file',

    /**
     * Specify guard to be used if you are using email or user_id
     * The default guard in config/auth.php is used if empty
     */
    'user_guard' => '',

    /**
     * Enable email notification for when a user is banned
     *
     */
    'enable_email_notification' => true,

    /**
     * Email address to be used for email notification
     *
     */
    'email_address' => '',
];

Route::middleware(['superban:X,Y,Z])->group(function () {
   Route::post('/thisroute', function () {
       // ...
   });
 
   Route::post('anotherroute', function () {
       // ...
   });
});
bash
php artisan vendor:publish --tag="superban-config"