New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

cresjie/ip-blocker

Laravel IP address blocker
40 3
Install
composer require cresjie/ip-blocker
Latest Version:v1.2.0.0
PHP:>=5.4.0
Laravel:5
Older releases:4
License:MIT
Last Updated:Jan 18, 2017
Links: GitHub  ·  Packagist
Maintainer: cresjie

Laravel 5 IP Blocker

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);
}

Related Packages

awescode/ip-firewall

The tool for protection your Laravel 5 website by IP. The system works with dyna...

100 6
magentron/laravel-firewall

Laravel IP firewall — whitelist, blacklist, and attack blocking. Fork of pragmar...

1,262 0
laravel-validation-rules/ip

Validate if an ip address is public or private.

29,777 16
pragmarx/firewall

A Laravel IP whitelisting and blacklisting

1,023,013 1,405
sarfraznawaz2005/visitlog

Laravel package to log visitor information into database.

18,903 88

Version History

Version Released PHP Laravel License
v1.2.0.0 >=5.4.0 >=5.0.0 MIT
v1.0.0.1 >=5.4.0 >=4.2.0 MIT
v1.0.0.0 >=5.4.0 4.2.* MIT