PHPackages                             jobmetric/laravel-ban-ips - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. jobmetric/laravel-ban-ips

ActiveLibrary[Security](/categories/security)

jobmetric/laravel-ban-ips
=========================

This is an annoying IP management package for Laravel that you can use in your projects.

1.6.0(9mo ago)511MITBladePHP &gt;=8.0.1

Since Mar 1Pushed 9mo ago2 watchersCompare

[ Source](https://github.com/jobmetric/laravel-ban-ips)[ Packagist](https://packagist.org/packages/jobmetric/laravel-ban-ips)[ Docs](https://doc.jobmetric.net/package/laravel-ban-ips)[ RSS](/packages/jobmetric-laravel-ban-ips/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (10)Used By (0)

[![Contributors](https://camo.githubusercontent.com/d761ce45d6dcf97ee7f54fb37f57c993df5fbdb7678d2939d39cc2ed6dd8bf6a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f6a6f626d65747269632f6c61726176656c2d62616e2d6970732e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/jobmetric/laravel-ban-ips/graphs/contributors)[![Forks](https://camo.githubusercontent.com/53042653fa6f09c70586855177f61116ad229f7838e18a6267bb1aef278eb00f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6a6f626d65747269632f6c61726176656c2d62616e2d6970732e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d466f726b)](https://github.com/jobmetric/laravel-ban-ips/network/members)[![Stargazers](https://camo.githubusercontent.com/81c63f74e1ea8247e9b144e5b47cc490b221924b7097367e5a4ea70dc24dfa03/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6a6f626d65747269632f6c61726176656c2d62616e2d6970732e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/jobmetric/laravel-ban-ips/stargazers)[![MIT License](https://camo.githubusercontent.com/3985cc72e78d7a0bd576a5400f380db6354543b1ccd5c5ac4f96a2b1220554ec/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6a6f626d65747269632f6c61726176656c2d62616e2d6970732e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/jobmetric/laravel-ban-ips/blob/master/LICENCE.md)[![LinkedIn](https://camo.githubusercontent.com/eb590f47a3fca74584d18db8dd3e985ae3d786f50cd41b7530c3af3885da233c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d4c696e6b6564496e2d626c75652e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d6c696e6b6564696e26636f6c6f72423d353535)](https://linkedin.com/in/majidmohammadian)

Ban Ip for laravel
==================

[](#ban-ip-for-laravel)

This is an annoying IP management package for Laravel that you can use in your projects.

Install via composer
--------------------

[](#install-via-composer)

Run the following command to pull in the latest version:

```
composer require jobmetric/laravel-ban-ips
```

Documentation
-------------

[](#documentation)

To use the services of this package, please follow the instructions below.

### Migrate

[](#migrate)

After installing the package, you must migrate by running the following command:

```
php artisan migrate
```

### Usage

[](#usage)

To use the services of this package, you must use the `BanIp` class in your model.

### Store Ban Ip

[](#store-ban-ip)

To store a ban ip, you can use the following code:

```
use JobMetric\BanIp\Facades\BanIp;

BanIp::store([
    'ip' => 'sample ip',
    'type' => 'hacker',
    'reason' => 'This is a sample reason',
    'banned_at' => now(),
    'expire_at' => now()->addDays(1),
]);
```

> Note:
>
> The `ip` field is required and must be a string.
>
> The `type` field is required and must be one of the following values: `hacker`, `spammer`, `bot`, `another`.
>
> The `reason` field is required and must be a string.
>
> The `banned_at` field is required and must be a date.
>
> The `expire_at` field is required and must be a date greater than the `banned_at` field.

### Update Ban Ip

[](#update-ban-ip)

To update a ban ip, you can use the following code:

```
use JobMetric\BanIp\Facades\BanIp;

BanIp::update([
    'type' => 'hacker',
    'reason' => 'This is a sample reason',
    'banned_at' => now(),
    'expire_at' => now()->addDays(1),
]);
```

> Note:
>
> The `type` field is sometimes and must be one of the following values: `hacker`, `spammer`, `bot`, `another`.
>
> The `reason` field is sometimes and must be a string.
>
> The `banned_at` field is sometimes and must be a date.
>
> The `expire_at` field is sometimes and must be a date greater than the `banned_at` field.

### Delete Ban Ip

[](#delete-ban-ip)

To delete a ban ip, you can use the following code:

```
use JobMetric\BanIp\Facades\BanIp;

BanIp::delete(/* ban ip id */);
```

### Delete Expired Ban Ip

[](#delete-expired-ban-ip)

To delete expired ban ip, you can use the following code:

```
use JobMetric\BanIp\Facades\BanIp;

BanIp::deleteExpired();
```

Helper Functions
----------------

[](#helper-functions)

This package contains several helper functions that you can use as follows:

- `storeBanIp`: This function is used to store a ban ip.
- `updateBanIp`: This function is used to update a ban ip.
- `deleteBanIp`: This function is used to delete a ban ip.
- `deleteExpiredBanIp`: This function is used to delete expired ban ip.

Rules
-----

[](#rules)

There are some rules for using this package:

- `BanIpExistRule`: This rule is used to check if the IP is banned.

Ban Type
--------

[](#ban-type)

There can be various reasons for the IP ban:

- `hacker`: This type of ban is used for hackers.
- `spammer`: This type of ban is used for spammers.
- `bot`: This type of ban is used for bots.
- `another`: This type of ban is used for other reasons.

Commands
--------

[](#commands)

This package contains several commands that you can use as follows

CommandDescription`ban-ip:remove`Remove ban ip expire time. (This command is executed every minute in your Laravel)Events
------

[](#events)

This package contains several events for which you can write a listener as follows

EventDescription`BanIpStoredEvent`This event is called after storing the ban ip.`BanIpUpdateEvent`This event is called after updating the ban ip.`BanIpDeleteEvent`This event is called after delete the ban ip.Contributing
------------

[](#contributing)

Thank you for considering contributing to the Laravel Ban Ip! The contribution guide can be found in the [CONTRIBUTING.md](https://github.com/jobmetric/laravel-ban-ips/blob/master/CONTRIBUTING.md).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/jobmetric/laravel-ban-ips/blob/master/LICENCE.md) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance57

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~64 days

Recently: every ~102 days

Total

9

Last Release

288d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b00d08bd4b0b765ee2d33719a535e6cb49c04fb945078a0809d5c05e6f16ee96?d=identicon)[majidmohammadian](/maintainers/majidmohammadian)

---

Top Contributors

[![MajidMohammadian](https://avatars.githubusercontent.com/u/2099965?v=4)](https://github.com/MajidMohammadian "MajidMohammadian (62 commits)")[![Fatememohamadii1](https://avatars.githubusercontent.com/u/186606208?v=4)](https://github.com/Fatememohamadii1 "Fatememohamadii1 (1 commits)")

---

Tags

ban-ipban-ip-adressipipv4laravellaravel-packagepackagelaravelpackageIPbanjobmetric

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jobmetric-laravel-ban-ips/health.svg)

```
[![Health](https://phpackages.com/badges/jobmetric-laravel-ban-ips/health.svg)](https://phpackages.com/packages/jobmetric-laravel-ban-ips)
```

###  Alternatives

[mchev/banhammer

Banhammer for Laravel allows you to ban any Model by key and by IP.

36693.4k2](/packages/mchev-banhammer)[enlightn/laravel-security-checker

A Laravel package to scan your dependencies for known security vulnerabilities.

51173.4k](/packages/enlightn-laravel-security-checker)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
