PHPackages                             delaney/superban - 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. delaney/superban

ActiveLibrary[Security](/categories/security)

delaney/superban
================

Ban clients completely for a period of time, based on the number of requests made in a selected interval

02PHP

Since Dec 22Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Delaney/Superban)[ Packagist](https://packagist.org/packages/delaney/superban)[ RSS](/packages/delaney-superban/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Superban
========

[](#superban)

Ban clients from your API for a period of time when they make too many requests within a set time.

Installation
------------

[](#installation)

In your Laravel app, using Composer, install the package and publish the configuration file:

```
composer require delaney\superban

```

Configuration &amp; Usage
-------------------------

[](#configuration--usage)

Publish the configuration file with this command:

```
php artisan vendor:publish --tag=superban

```

`config\superban`

```
/*
 * Config file for the Superban package.
 */

return [
    /*
    |--------------------------------------------------------------------------
    | Superban - Cache Stores
    |--------------------------------------------------------------------------
    |
    | This is an array of cache stores to use with Superban.
    | Leaving this as empty would use the default cache store.
    |
    | Example:
    | ['redis', 'file']
    |
    */
    'drivers' => [],

    /*
    |--------------------------------------------------------------------------
    | Superban - Ban IP Addresses
    |--------------------------------------------------------------------------
    |
    | Add the IP address when banning a client.
    |
    */
    'ban_ip_addresses' => env('SUPERBAN_BAN_IP', true),

    /*
    |--------------------------------------------------------------------------
    | Superban - User Keys
    |--------------------------------------------------------------------------
    |
    | This is a list of keys to ban the client user.
    | These keys should be available on your user model.
    |
    */
    'user_keys' => ['id', 'email'],

    /*
    |--------------------------------------------------------------------------
    | Superban - Message
    |--------------------------------------------------------------------------
    |
    | Message to display to a banned client in the HTTP Response
    |
    | Default: "You have been banned temporarily."
    |
    */
    'message' => env('SUPERBAN_ERROR_MESSAGE'),
];

```

You can specify options in your `.env` file using:

```
SUPERBAN_BAN_IP=false
SUPERBAN_ERROR_MESSAGE="This request is banned"

```

### Using the middleware

[](#using-the-middleware)

To add Superban to your routes, simply use it like you would any other middleware, using the alias `superban` and specifying your parameters, with time in minutes. For example:

```
Route::post('clear')->middleware('superban:100,60,1440');

Route::prefix('/resources')->middleware('superban:20,1,10')
    ->group(function() {
        Route::get() ...

```

In the first line, users who make 100 requests within 1 hour (60 minutes) will get banned for 24 hours (1440). And in the second middleware group, users exceeding 20 requests in a minute will get banned for 10 minutes.

License
-------

[](#license)

MIT

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity20

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/20409469123a0dad650dc7e55248de830bd718960d7dc153056e9a7add5df962?d=identicon)[Delaney](/maintainers/Delaney)

---

Top Contributors

[![Delaney](https://avatars.githubusercontent.com/u/25111543?v=4)](https://github.com/Delaney "Delaney (13 commits)")

### Embed Badge

![Health badge](/badges/delaney-superban/health.svg)

```
[![Health](https://phpackages.com/badges/delaney-superban/health.svg)](https://phpackages.com/packages/delaney-superban)
```

###  Alternatives

[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k18.7M143](/packages/mews-purifier)[paragonie/ecc

PHP Elliptic Curve Cryptography library

24820.0k37](/packages/paragonie-ecc)

PHPackages © 2026

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