PHPackages                             laravel-interaction/block - 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. laravel-interaction/block

ActiveLibrary

laravel-interaction/block
=========================

User block/unblock behaviour for Laravel.

3.5.0(1mo ago)1105MITPHPPHP ^8.0CI failing

Since Oct 15Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/laravel-interaction/block)[ Packagist](https://packagist.org/packages/laravel-interaction/block)[ Docs](https://github.com/laravel-interaction/block)[ RSS](/packages/laravel-interaction-block/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (12)Versions (19)Used By (0)

Laravel Block
=============

[](#laravel-block)

User block/unblock behaviour for Laravel.

[![Latest Stable Version](https://camo.githubusercontent.com/2ab90b74f090d4972f6744b6bd13b2edcae1817204c8ea61059437fb70fe4f30/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f626c6f636b2f762f737461626c652e737667)](https://packagist.org/packages/laravel-interaction/block)[![Total Downloads](https://camo.githubusercontent.com/5aa64b1e16359d77e03d2bcd21cfbfa6df7ac87353719ac1af333eb14d13a883/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f626c6f636b2f646f776e6c6f616473)](https://packagist.org/packages/laravel-interaction/block)[![Latest Unstable Version](https://camo.githubusercontent.com/82bd12f27103ef5c340f726aeb43ce177da0571aa1ac0d051a1e3ef22831e7cc/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f626c6f636b2f762f756e737461626c652e737667)](https://packagist.org/packages/laravel-interaction/block)[![License](https://camo.githubusercontent.com/ed5fe02b60d332036b6c9d1fd761fc8e36a965907096f04cae55d0db383baa4f/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f626c6f636b2f6c6963656e7365)](https://packagist.org/packages/laravel-interaction/block)

Introduction
------------

[](#introduction)

It let people express how they feel about the model(documentation/subject/topic), prevent this model from interacting with you and sending you notifications.

[![](https://camo.githubusercontent.com/c84410694602dfabb4f1a125bc15515bf0f2beb9adc618cde41dab9f09cc4e53/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2546302539462539412541372d312e326b2d677265656e3f7374796c653d736f6369616c)](https://camo.githubusercontent.com/c84410694602dfabb4f1a125bc15515bf0f2beb9adc618cde41dab9f09cc4e53/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2546302539462539412541372d312e326b2d677265656e3f7374796c653d736f6369616c)

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

[](#installation)

### Requirements

[](#requirements)

- [PHP 8.0+](https://php.net/releases/)
- [Composer](https://getcomposer.org)
- [Laravel 8.0+](https://laravel.com/docs/releases)

### Instructions

[](#instructions)

Require Laravel Block using [Composer](https://getcomposer.org).

```
composer require laravel-interaction/block
```

Publish configuration and migrations

```
php artisan vendor:publish --tag=block-config
php artisan vendor:publish --tag=block-migrations
```

Run database migrations.

```
php artisan migrate
```

Usage
-----

[](#usage)

### Setup Blocker

[](#setup-blocker)

```
use Illuminate\Database\Eloquent\Model;
use LaravelInteraction\Block\Concerns\Blocker;

class User extends Model
{
    use Blocker;
}
```

### Setup Blockable

[](#setup-blockable)

```
use Illuminate\Database\Eloquent\Model;
use LaravelInteraction\Block\Concerns\Blockable;

class Channel extends Model
{
    use Blockable;
}
```

### Blocker

[](#blocker)

```
use LaravelInteraction\Block\Tests\Models\Channel;
/** @var \LaravelInteraction\Block\Tests\Models\User $user */
/** @var \LaravelInteraction\Block\Tests\Models\Channel $channel */
// Block to Blockable
$user->block($channel);
$user->unblock($channel);
$user->toggleBlock($channel);

// Compare Blockable
$user->hasBlocked($channel);
$user->hasNotBlocked($channel);

// Get blocked info
$user->blockerBlocks()->count();

// with type
$user->blockerBlocks()->withType(Channel::class)->count();

// get blocked channels
Channel::query()->whereBlockedBy($user)->get();

// get blocked channels doesnt blocked
Channel::query()->whereNotBlockedBy($user)->get();
```

### Blockable

[](#blockable)

```
use LaravelInteraction\Block\Tests\Models\User;
use LaravelInteraction\Block\Tests\Models\Channel;
/** @var \LaravelInteraction\Block\Tests\Models\User $user */
/** @var \LaravelInteraction\Block\Tests\Models\Channel $channel */
// Compare Blocker
$channel->isBlockedBy($user);
$channel->isNotBlockedBy($user);
// Get blockers info
$channel->blockers->each(function (User $user){
    echo $user->getKey();
});

$channels = Channel::query()->withCount('blockers')->get();
$channels->each(function (Channel $channel){
    echo $channel->blockers()->count(); // 1100
    echo $channel->blockers_count; // "1100"
    echo $channel->blockersCount(); // 1100
    echo $channel->blockersCountForHumans(); // "1.1K"
});
```

### Events

[](#events)

EventFired`LaravelInteraction\Block\Events\Blocked`When an object get blocked.`LaravelInteraction\Block\Events\Unblocked`When an object get unblocked.License
-------

[](#license)

Laravel Block is an open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance89

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 90.9% 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 ~95 days

Recently: every ~274 days

Total

18

Last Release

53d ago

Major Versions

1.x-dev → 2.0.0-beta.12022-03-10

2.x-dev → 3.0.02022-11-27

PHP version history (3 changes)1.1.0PHP ^7.2 || ^8.0

2.0.0-beta.1PHP ^7.3 || ^8.0

3.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5fafa5bffa28dcd722432b244bf3f0bfe773406df29fea295847e2397b95d50b?d=identicon)[zingimmick](/maintainers/zingimmick)

---

Top Contributors

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

---

Tags

blocklaravellaravelblock

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laravel-interaction-block/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[cybercog/laravel-ban

Laravel Ban simplify blocking and banning Eloquent models.

1.1k651.8k11](/packages/cybercog-laravel-ban)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[laravel-interaction/bookmark

User bookmark/unbookmark behaviour for Laravel.

105.0k](/packages/laravel-interaction-bookmark)

PHPackages © 2026

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