You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://opensource.org/license/mit)[](https://github.com/rahulalam31/Laravel-Abuse-IP/actions/workflows/update_spamiplist.yml)
9
8
10
-
11
-
Adds a Security to Laravel for checking whether the IP address is safe or marked as spam to keep you out of worry from spammers and fake data to your website.
9
+
Adds a Security to Laravel for checking whether the IP address is safe or marked as spam to keep you out of worry from spammers and fake data to your website.
12
10
Uses the AbuseIPDB blocklist from [borestad/blocklist-abuseipdb](https://github.com/borestad/blocklist-abuseipdb) by default.
13
11
14
12
### Installation
15
13
16
14
1. Run the Composer require command to install the package. The service provider is discovered automatically.
17
15
18
16
```bash
19
-
composer require rahulalam31/laravel-abuse-ip
17
+
composer require rahulalam31/laravel-abuse-ip
20
18
```
21
19
22
20
2. Publish the configuration file and adapt the configuration as desired:
@@ -26,35 +24,37 @@ Uses the AbuseIPDB blocklist from [borestad/blocklist-abuseipdb](https://github.
26
24
```
27
25
28
26
3. Run the following artisan command to fetch an up-to-date list of disposable domains:
29
-
27
+
30
28
```bash
31
29
php artisan abuseip:update
32
30
```
33
31
34
-
3.1. Add the following to you ```.env``` file.
35
-
Add ```ABUSEIP_STORAGE_PATH``` to change your storage location,
36
-
Add ```ABUSEIP_STORAGE_COMPRESS``````true/false``` to enable or disable ```ip2long()```
32
+
3.1. Add the following to you `.env` file.
33
+
Add `ABUSEIP_STORAGE_PATH` to change your storage location,
34
+
Add `ABUSEIP_STORAGE_COMPRESS``true/false` to enable or disable `ip2long()`
37
35
36
+
4. (optional) It's highly advised to update the AbuseIp list daily as the spam ip address keeps changing daily, but you can schedule it as per your need regularly. You can either run the command yourself now and then or, if you make use of Laravel's scheduler, you can register the `abuseip:update` command:
38
37
39
-
4. (optional) It's highly advised to update the AbuseIp list daily as the spam ip address keeps changing daily, but you can schedule it as per your need regularly. You can either run the command yourself now and then or, if you make use of Laravel's scheduler, you can register the `abuseip:update` command:
38
+
In `routes/console.php`:
40
39
41
-
In `routes/console.php`:
42
40
```php
43
41
use Illuminate\Support\Facades\Schedule;
44
-
//
42
+
//
45
43
Schedule::command('abuseip:update')->daily();
46
44
```
47
45
48
46
Or if you use Laravel 10 or below, head over to the Console kernel:
49
-
```php
50
-
protected functionschedule(Schedule$schedule)
51
-
{
52
-
$schedule->command('abuseip:update')->daily();
53
-
}
47
+
48
+
```php
49
+
protected functionschedule(Schedule$schedule)
50
+
{
51
+
$schedule->command('abuseip:update')->daily();
52
+
}
54
53
```
54
+
55
55
### Usage
56
56
57
-
Use the `middleware::AbuseIp::class` where ever required like in form page or post urls.Or you can add the middleware to your code, For Laravel 10 and below add the middleware `Http/Kernel.php`, For Laravel 11 add to `bootstrap/app/php`
57
+
Use the `middleware::AbuseIp::class` where ever required like in form page or post urls.Or you can add the middleware to your code, For Laravel 10 and below add the middleware `Http/Kernel.php`, For Laravel 11 add to `bootstrap/app/php`
58
58
59
59
```php
60
60
//Laravel 10 and below
@@ -63,25 +63,55 @@ Use the `middleware::AbuseIp::class` where ever required like in form page or po
If you don't want to put it in your route middleware you can make a `aliasMiddleware()` and use the alias in your routes file to disable spam ip visits.
0 commit comments