rabianr / laravel-ip-restrictions
Laravel 的 IP 限制中间件
1.2
2022-01-31 07:55 UTC
Requires
- php: >=7.2
- illuminate/contracts: ^6|^7|^8|^9
- illuminate/support: ^6|^7|^8|^9
- symfony/http-foundation: ^4|^5
- symfony/http-kernel: ^4|^5
Requires (Dev)
- laravel/framework: ^6|^7|^8
- phpunit/phpunit: ^6|^7|^8|^9
This package is auto-updated.
Last update: 2024-09-29 05:56:59 UTC
README
安装
composer require rabianr/laravel-ip-restrictions
配置
发布配置以将文件复制到您的配置目录
php artisan vendor:publish --tag="iprestrictions"
使用方法
将 iprestrictions
中间件设置到任何需要基本身份验证的路由。
在 config/iprestrictions.php
配置文件中定义 IP 地址。
'whitelist' => array_merge([ '1.1.1.1', ], array_filter(explode(',', env('IPRESTRICTIONS_WHITELIST', '')))),
或者在 .env
文件中
IPRESTRICTIONS_WHITELIST=1.1.1.1,1.1.1.2