PHPackages                             muazzambuilds/filament-ban - 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. muazzambuilds/filament-ban

ActiveLibrary

muazzambuilds/filament-ban
==========================

Ban and suspend users from Filament — middleware blocks panel, API, and login.

972[1 PRs](https://github.com/muazzambuilds/filament-ban/pulls)PHP

Since Jul 14Pushed 1mo agoCompare

[ Source](https://github.com/muazzambuilds/filament-ban)[ Packagist](https://packagist.org/packages/muazzambuilds/filament-ban)[ RSS](/packages/muazzambuilds-filament-ban/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

 [![Filament Ban](media/cover-2560x1440.jpg)](media/cover-2560x1440.jpg)

Filament Ban
============

[](#filament-ban)

Ban and suspend users from **Filament v5**. Add actions to your user resource; middleware blocks the panel, API, and login when an account is banned or suspended.

 [![Users table with Ban, Suspend, and Unban actions](art/screenshot.png)](art/screenshot.png)

Requirements
------------

[](#requirements)

DependencyVersionPHP`^8.2`Laravel`^11` / `^12`Filament`^5.0`Installation
------------

[](#installation)

```
composer require muazzambuilds/filament-ban
```

Publish the config and migration:

```
php artisan vendor:publish --tag=filament-ban-config
php artisan vendor:publish --tag=filament-ban-migrations
php artisan migrate
```

Setup
-----

[](#setup)

### 1. Add the trait to your user model

[](#1-add-the-trait-to-your-user-model)

```
use MuazzamBuilds\FilamentBan\Concerns\Bannable;

class User extends Authenticatable
{
    use Bannable;
}
```

### 2. Register the panel plugin

[](#2-register-the-panel-plugin)

```
use MuazzamBuilds\FilamentBan\BanPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugin(BanPlugin::make());
}
```

This attaches auth middleware so banned / suspended users cannot use the panel (and are logged out).

### 3. Protect API routes

[](#3-protect-api-routes)

```
Route::middleware(['auth:sanctum', 'banned'])->group(function () {
    // …
});
```

Login is blocked automatically via Laravel’s `Validated` auth event — no custom login page required.

### 4. Add actions to your user resource

[](#4-add-actions-to-your-user-resource)

```
use MuazzamBuilds\FilamentBan\Actions\BanAction;
use MuazzamBuilds\FilamentBan\Actions\SuspendAction;
use MuazzamBuilds\FilamentBan\Actions\UnbanAction;
use MuazzamBuilds\FilamentBan\Actions\UnsuspendAction;

public function getRecordActions(): array
{
    return [
        BanAction::make(),
        UnbanAction::make(),
        SuspendAction::make(),
        UnsuspendAction::make(),
    ];
}
```

Or on a table:

```
->recordActions([
    BanAction::make(),
    UnbanAction::make(),
    SuspendAction::make(),
    UnsuspendAction::make(),
])
```

Behaviour
---------

[](#behaviour)

StateEffect**Banned** (`banned_at` set)Permanent block until unbanned**Suspended** (`suspended_until` in the future)Temporary block; lifts automatically when the time passesBlocked users:

- Cannot log in (validation error with ban/suspend message)
- Are rejected from Filament panels (plugin middleware)
- Are rejected from routes using the `banned` middleware (API-friendly JSON 403)

Model API
---------

[](#model-api)

```
$user->ban('Spam');
$user->unban();
$user->suspend(now()->addDays(7), 'Cool down');
$user->unsuspend();

$user->isBanned();
$user->isSuspended();
$user->isAccessBlocked();
```

Query scopes: `User::banned()`, `User::notBanned()`, `User::suspended()`, `User::accessBlocked()`.

Config
------

[](#config)

```
// config/filament-ban.php
'user_model' => 'App\\Models\\User',
'logout' => true,
'api_status' => 403,
'web_redirect' => null, // route name or path; null throws AuthenticationException
```

Support
-------

[](#support)

If this package helps you, consider supporting development:

[![Buy Me A Coffee](https://camo.githubusercontent.com/ae1848f99ea87c538c70dd9051798b769ba715939b8398ed02ad68a7da5d22bc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275792532304d6525323061253230436f666665652d6666646430303f7374796c653d666f722d7468652d6261646765266c6f676f3d6275792d6d652d612d636f66666565266c6f676f436f6c6f723d626c61636b)](https://buymeacoffee.com/muazzambuilds)

License
-------

[](#license)

MIT

###  Health Score

24

—

LowBetter than 30% of packages

Maintenance60

Regular maintenance activity

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity11

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://avatars.githubusercontent.com/u/300896156?v=4)[Muazzam Ali Khan](/maintainers/muazzambuilds)[@muazzambuilds](https://github.com/muazzambuilds)

---

Top Contributors

[![muazzambuilds](https://avatars.githubusercontent.com/u/300896156?v=4)](https://github.com/muazzambuilds "muazzambuilds (3 commits)")

### Embed Badge

![Health badge](/badges/muazzambuilds-filament-ban/health.svg)

```
[![Health](https://phpackages.com/badges/muazzambuilds-filament-ban/health.svg)](https://phpackages.com/packages/muazzambuilds-filament-ban)
```

PHPackages © 2026

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