PHP code example of alitindrawan24 / laravel-ip-whitelist

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

    

alitindrawan24 / laravel-ip-whitelist example snippets


/**
 * List of IP Whitelist.
 * Only IP in this list is allowed to pass the middleware.
 */
'ip_whitelist' => [
    // '127.0.0.1' // Localhost example
    // '127.0.0.*' // Using Wildcard example
],

// in `app/Http/Kernel.php`

protected $middleware = [
    // ...
    
    \Alitindrawan24\IPWhitelist\Middleware\HttpLogger::class
];

// in a routes file

Route::post('/dashboard', function () {
    //
})->middleware(\Alitindrawan24\IPWhitelist\Middleware\HttpLogger::class);
bash
php artisan vendor:publish --provider="Alitindrawan24\IPWhitelist\IPWhitelistServiceProvider" --tag="config"