PHP code example of xultech / laravel-ip-whitelist
1. Go to this page and download the library: Download xultech/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/ */
xultech / laravel-ip-whitelist example snippets
return [
'enabled' => true,
'storage' => 'config', // or 'database'
'whitelisted_ips' => [
'127.0.0.1',
'192.168.*.*',
'10.0.0.0/16',
],
'table' => 'ip_whitelist_entries',
'table_prefix' => '',
'allow_env_override' => true,
'env_key' => 'IP_WHITELIST_OVERRIDE',
'response' => [
'type' => 'abort', // redirect | json | abort
'redirect_to' => '/unauthorized',
'json' => [
'message' => 'Your IP is not authorized.',
'code' => 403,
],
'status_code' => 403,
'message' => 'Access denied. Your IP is not whitelisted.',
],
];