Package Data | |
---|---|
Maintainer Username: | cresjie |
Maintainer Contact: | cresjie@gmail.com (Cres Jie Labasano) |
Package Create Date: | 2016-02-01 |
Package Last Update: | 2017-01-18 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-22 03:05:55 |
Package Statistics | |
---|---|
Total Downloads: | 37 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 3 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Simple and easy to configure laravel ip blocker
for Laravel 4
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,
)
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
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);
}