Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Ip Blocker Laravel Package

cresjie/ip-blocker

Simple Laravel 5 IP blocker. Install via Composer, publish config, and list blocked IPs in config/cresjie/block-ip.php. When a request matches, it throws IpBlockerException so you can render a custom “blocked” view in your exception handler.

View on GitHub
Deep Wiki
Context7

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

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle