voyager-inc/simple-block-blacklist-and-whitelist-ip
Composer 安装命令:
composer require voyager-inc/simple-block-blacklist-and-whitelist-ip
包简介
Simple block ip depend on blacklist and whitelist ip
README 文档
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']
统计信息
- 总下载量: 69
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-05-08