voyager-inc / simple-block-blacklist-and-whitelist-ip
Simple block ip depend on blacklist and whitelist ip
Installs: 29
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/voyager-inc/simple-block-blacklist-and-whitelist-ip
Requires
- php: ^8.2
- illuminate/support: ^11.0
Requires (Dev)
- orchestra/testbench: ^4|^5|^6|^7|^8|^9
This package is auto-updated.
Last update: 2025-10-24 10:43:28 UTC
README
Installation
composer require voyager-inc/simple-block-blacklist-and-whitelist-ip
- Publish provider
php artisan vendor:publish --provider="VoyagerInc\SimpleBlockBlacklistAndWhiteListIp\ServiceProvider"
Now you will see two migration files create_simple_blacklist_ips_table.php and create_simple_whitelist_ips_table.php in database/migrations folder
- Run migration
php artisan migrate
Usage
- We have two new middleware with the aliases
ip-filter-whitelistandip-filter-blacklist - The
ip-filter-whitelistmiddleware allows access only from whitelisted IPs. - The
ip-filter-blacklistmiddleware always prevents access from blacklisted IPs. - We can update whitelist and blacklist in config
simple_block_blacklist_and_whitelist_ip.phpfile
<?php return [ 'block_ip_enable' => true, 'block_by' => 'config', // or database 'whitelist_ip' => [ // ], 'blacklist_ip' => [ // ], ];
- Example
Route::get('/test', function () { return 'Whitelist route'; })->middleware(['ip-filter-whitelist']); // middleware(['ip-filter-blacklist']