PHPackages                             kyrch/laravel-prohibitions - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. kyrch/laravel-prohibitions

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

kyrch/laravel-prohibitions
==========================

Prohibit your models from execute an action in a way similar to spatie/laravel-permission.

v1.2(4mo ago)571.8kMITPHPPHP ^8.4CI passing

Since Dec 22Pushed 1mo agoCompare

[ Source](https://github.com/Kyrch/laravel-prohibitions)[ Packagist](https://packagist.org/packages/kyrch/laravel-prohibitions)[ Docs](https://github.com/kyrch/laravel-prohibitions)[ GitHub Sponsors](https://github.com/Kyrch)[ RSS](/packages/kyrch-laravel-prohibitions/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (5)Dependencies (14)Versions (11)Used By (0)

Prohibit your models
====================

[](#prohibit-your-models)

[![Latest Version on Packagist](https://camo.githubusercontent.com/615ed47764067e79220040c3b1feb476d2694823d80ac439aec7930a596f0f75/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b797263682f6c61726176656c2d70726f6869626974696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kyrch/laravel-prohibitions)[![GitHub Tests Action Status](https://camo.githubusercontent.com/c30962c59a13f2344b9e48c7442cdcaeb96047fc71ac33da980feddff2aad168/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6b797263682f6c61726176656c2d70726f6869626974696f6e732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/kyrch/laravel-prohibitions/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/744d21b15ea7be91497ef1c9d27a33417283c8289a6f543f8620af1050172705/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6b797263682f6c61726176656c2d70726f6869626974696f6e732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/kyrch/laravel-prohibitions/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/97870181eddd1f73945193cc30aa2d354f59a362285ddb04695d6f240b01c4f8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b797263682f6c61726176656c2d70726f6869626974696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kyrch/laravel-prohibitions)

Description
-----------

[](#description)

Laravel Prohibitions is a Laravel package that allows you to prohibit users from executing specific actions for a determined period of time.

Instead of relying on hard-coded checks or ad-hoc flags, this package introduces a sanction-based system where actions can be explicitly denied through well-defined rules.

The package also provides a Sanction model, which works as a preset of prohibited actions, making it easy to group multiple prohibitions under a single disciplinary rule — such as temporary bans, feature restrictions, or full account suspensions.

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

[](#installation)

You can install the package via composer:

```
composer require kyrch/laravel-prohibitions
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-prohibitions-config"
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="laravel-prohibitions-migrations"
```

### Usage

[](#usage)

#### Setup

[](#setup)

Add the `HasSanctions` trait to your User model:

```
use Kyrch\Prohibition\Traits\HasSanctions;

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

You need to create your sanctions and prohibitions first. For example:

```
$prohibition = Prohibition::query()->create(['name' => 'update post']);

$sanction = Sanction::query()->create(['name' => 'posts']);

$prohibition->sanctions()->attach($sanction);
```

#### How to prohibit

[](#how-to-prohibit)

Now you can use methods this packages provides, such as:

```
# Prohibit the user from updating any posts.
$user->prohibit('update post', now()->addWeek());

# Similar to roles, you can create a kind of "ban preset" that has a group of prohibitions.
$user->applySanction('posts', now()->addWeek());

# Check if user is prohibited from updating any post.
$user->isProhibitedFrom('update post');
```

It is recommended to use the `isProhibitedFrom()` method in your `Gate::before` or the `before` method in your policy class.

#### Events

[](#events)

There are two events: `ModelProhibitionTriggered` and `ModelSanctionTriggered`. If you don't want them enabled, you can disable it in the published config file.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Kyrch](https://github.com/Kyrch)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance85

Actively maintained with recent releases

Popularity31

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.1% 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 ~17 days

Total

6

Last Release

109d ago

Major Versions

v1.2 → 2.x-dev2026-03-18

### Community

Maintainers

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

---

Top Contributors

[![Kyrch](https://avatars.githubusercontent.com/u/66730850?v=4)](https://github.com/Kyrch "Kyrch (41 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelKyrchlaravel-prohibitions

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/kyrch-laravel-prohibitions/health.svg)

```
[![Health](https://phpackages.com/badges/kyrch-laravel-prohibitions/health.svg)](https://phpackages.com/packages/kyrch-laravel-prohibitions)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M101](/packages/dedoc-scramble)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[wnx/laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.

213421.2k2](/packages/wnx-laravel-backup-restore)

PHPackages © 2026

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