定制 cresjie/ip-blocker 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

cresjie/ip-blocker

Composer 安装命令:

composer require cresjie/ip-blocker

包简介

Laravel IP address blocker

README 文档

README

Simple and easy to configure laravel ip blocker

for Laravel 4

Installation via Composer

Add this to your composer.json file, in the require object:

 "cresjie/ip-blocker": "v1.2.0.0"

After that, run composer install to install the package.

Add the service provider to app/config/app.php for laravel 4 and config/app.php for laravel 5, within the providers array.

 'providers' => array(
	...
	Cresjie\IpBlocker\IpBlockerServiceProvider::class,
)

Configuration

Publish the default config file to your application so you can make modifications.

$ php artisan vendor:publish

Add your block IP's to the configuration file:

 [L5 root]/config/cresjie/block-ip.php

Handling/Custom View

if the IP was blocked, it would throw Cresjie\IpBlocker\IpBlockerException. you could create a view by just handling the exception like this:

#laravel 5

// app/Exceptions/Handler.php

public function render($request, Exception $e)
{
	switch($e){
		case ($e instanceof \Cresjie\IpBlocker\IpBlockerException):
			return response()->view('view-path');
			break;
		default:
			return parent::render($request, $e);

	}

    return parent::render($request, $e);
}

统计信息

  • 总下载量: 40
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-02-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固