承接 mares29/laravel-ip-filter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mares29/laravel-ip-filter

Composer 安装命令:

composer require mares29/laravel-ip-filter

包简介

Filter request by IP addresses for Laravel

README 文档

README

This package provide simple way to filter user access by IP addresses for your Laravel 5 application.

Install

Via Composer

$ composer require mares29/laravel-ip-filter

Laravel 5.5+ automaticly register service provider and set Alias thanks to auto-discovery. With lower laravel version add to app.php

'providers' => [
	\Mares29\Breadcrumb\FilterIpServiceProvider::class,
]

Usage

Export filter config.

php artisan vendor:publish --provider="Mares29\IpFilter\FilterIpServiceProvider"

By default the filter is active only on production environment, but you can specify Your own settings in config file.

	// Env - only use filter on listed environments
	'env' => ['production'],

Use one of black list or white list method. For example, allow acces only from ip address 127.0.0.1.

	// White list - List of allowed IP addresses
	'allowed' => [
		'127.0.0.1'
	],

	// Black list - List of denied IP addresses
	'denied' => [],

Add middleware for all Your web routes.

protected function mapWebRoutes()
    {
        Route::middleware('web')
             ->middleware('filterIp')
             ->namespace($this->namespace)
             ->group(base_path('routes/web.php'));
    }

Or just for specific routes.

Route::get('/', function () {
    return view('welcome');
})->middleware('filterIp');

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 13.31k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固