PHPackages                             rellix/dismissibles-for-laravel - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. rellix/dismissibles-for-laravel

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

rellix/dismissibles-for-laravel
===============================

A Laravel package for easily handling the visibility of dismissible, recurring objects like popups/notifications/modals on the server side.

5.1.0(2y ago)431551MITPHPPHP ^8.1

Since Apr 23Pushed 2y ago2 watchersCompare

[ Source](https://github.com/rellix999/dismissibles-for-laravel)[ Packagist](https://packagist.org/packages/rellix/dismissibles-for-laravel)[ RSS](/packages/rellix-dismissibles-for-laravel/feed)WikiDiscussions main Synced 1mo ago

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

📣 Dismissibles for Laravel
==========================

[](#-dismissibles-for-laravel)

[![Dismissibles for Laravel](./images/dismissibles-for-laravel.jpg)](./images/dismissibles-for-laravel.jpg)

A Laravel package for easily managing the visibility of your recurring, dismissible objects like popups/notifications/modals on the backend. This package does not include frontend components, so it's compatible with any frontend you can use.

📕 Table of Contents
-------------------

[](#-table-of-contents)

- [✅ What problem does this solve?](#-what-problem-does-this-solve)
- [📦 Installation](#-installation)
- [❓ How to use](#-how-to-use)
- [❗ Good to know](#-good-to-know)
- [💾 Database tables](#-database-tables)
- [☕ Buy me a coffee](#-buy-me-a-coffee)

✅ What problem does this solve?
-------------------------------

[](#-what-problem-does-this-solve)

Say you have a popup you want to show to every user, daily for a week. Users can dismiss it and it should not show up again for the rest of the day until the next day.

This packages handles the complex logic regarding whether the (dismissible) popup should be visible to the current user at the current moment. It basically handles the visibility of your dismissible. It's highly customizable, making it very flexible for many scenario's.

Because it's serverside we can easily get statistics like who dismissed what, when and where.

📦 Installation
--------------

[](#-installation)

1. Require the package in your Laravel application

```
composer require rellix/dismissibles-for-laravel
```

2. Run the migrations to create the database tables

```
php artisan migrate
```

❓ How to use
------------

[](#-how-to-use)

### 1. Add the interface and trait to any model

[](#1-add-the-interface-and-trait-to-any-model)

```
use Rellix\Dismissibles\Contracts\Dismisser;
use Rellix\Dismissibles\Traits\HasDismissibles;

class User implements Dismisser
{
    use HasDismissibles;

    ...
}
```

### 2. Create a dismissible (migration)

[](#2-create-a-dismissible-migration)

```
use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\DB;

return new class () extends Migration {
    public function up(): void
    {
        DB::table('dismissibles')->insert([
            'name'         => 'Test Popup', // This is your **unique** identifier
            'active_from'  => Date::createFromFormat('d-m-Y', '01-03-2024'),
            'active_until' => null, // Optional end date
            'created_at'   => Date::now(),
            'updated_at'   => Date::now(),
        ]);
    }
};
```

and run your created migration:

```
php artisan migrate
```

💡 You can also create/fetch a Dismissible inline using the "active"-scope and "firstOrCreate".```
Dismissible::active()->firstOrCreate(
    ['name' => 'Test Popup'],
    [
        'active_from'  => Date::createFromFormat('d-m-Y', '01-03-2024'),
        'active_until' => null,
        'created_at'   => Date::now(),
        'updated_at'   => Date::now(),
    ]
);
```

### 3. Check if it should be visible at the current moment

[](#3-check-if-it-should-be-visible-at-the-current-moment)

```
use Rellix\Dismissibles\Facades\Dismissibles;

$showPopup = Dismissibles::shouldBeVisible('Test Popup', $user);

// Here are some more examples, including ones with additional conditionals:
$showPopup = Dismissibles::shouldBeVisible('Happy New Year 2025 Popup', $user);
$showPopup = Dismissibles::shouldBeVisible('Newsletter signup modal', $user) && !$user->is_subscribed;
$showPopup = Dismissibles::shouldBeVisible('Complete your profile notification', $user) && !$user->has_completed_profile;
$showPopup = Dismissibles::shouldBeVisible('50% Off First Purchase Popup', $user) && !$user->has_orders;

// You can also get all Dismissibles in one query (performance) and use the model methods.
$dismissibles = Dismissibles::getAllFor($user);
```

💡 You can also use the individual models.```
use Rellix\Dismissibles\Facades\Dismissibles;

$popup = Dismissibles::get('Test Popup');

$showPopup = $popup->shouldBeVisibleTo($user);
```

### 4. Dismiss it for a specified period

[](#4-dismiss-it-for-a-specified-period)

```
use Rellix\Dismissibles\Facades\Dismissibles;

Dismissibles::dismiss('Test Popup', $user)->untilNextWeek();

// Here's an overview of all the ways you can dismiss:
Dismissibles::dismiss('Test Popup', $user)
    ->untilTomorrow();
    ->untilNextWeek();
    ->untilNextMonth();
    ->untilNextQuarter();
    ->untilNextYear();
    ->until($dateTime);
    ->forHours($numberOfHours);
    ->forDays($numberOfDays);
    ->forWeeks($numberOfWeeks);
    ->forMonths($numberOfMonths);
    ->forYears($numberOfYears);
    ->forever();
```

💡 You can also use the individual models.```
use Rellix\Dismissibles\Facades\Dismissibles;

$popup = Dismissibles::get('Test Popup');

// Here's an overview of all the ways you can dismiss:
$popup->dismissFor($user)
    ->untilTomorrow();
    ->untilNextWeek();
    ->untilNextMonth();
    ->untilNextQuarter();
    ->untilNextYear();
    ->until($dateTime);
    ->forHours($numberOfHours);
    ->forDays($numberOfDays);
    ->forWeeks($numberOfWeeks);
    ->forMonths($numberOfMonths);
    ->forYears($numberOfYears);
    ->forever();
```

❗ Good to know
--------------

[](#-good-to-know)

- The facade contains some oneliners by `$name`, but you can also use the scopes/methods in the `Dismissible` and `Dismissal` Eloquent models as you wish for ultimate flexibility.
- It's recommended to centralize dismissible names in an enum (or config)
- Need extra data regarding the dismissal? All dismiss methods allow you to pass an `$extraData` array as last parameter which will be written to the `dismissals` table as json.
- Feel free to request more methods/scopes

💾 Database tables
-----------------

[](#-database-tables)

The database structure allows you to easily track activity regarding dismissibles. Due to the `extra_data` column it's also very flexible!

### dismissibles (popups, notifications, modals)

[](#dismissibles-popups-notifications-modals)

idnameactive\_fromactive\_untilcreated\_atupdated\_at3Test Popup2024-03-01 00:00:00null2023-12-15 17:35:542023-12-15 17:35:54### dismissals (activity)

[](#dismissals-activity)

iddismissible\_iddismisser\_typedismisser\_iddismissed\_untilextra\_datacreated\_atupdated\_at153App\\Models\\User3282024-04-29 00:00:00"{"route":"home.index"}"2024-04-28 17:35:542024-04-28 17:35:54☕ Buy me a coffee
-----------------

[](#-buy-me-a-coffee)

If you like this package, consider [buying me a coffee](https://www.paypal.com/donate/?business=E6QBKXWLXMD92&no_recurring=1&item_name=Buy+me+a+coffee&currency_code=EUR) :-).

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~1 days

Total

9

Last Release

735d ago

Major Versions

1.0.0 → 2.0.02024-04-27

2.0.0 → 3.0.02024-04-28

3.0.0 → 4.0.02024-04-29

4.1.2 → 5.0.02024-05-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/9151b30ab85161b1108849ac3131babd4d5c7742f304708014094b6ceffd2773?d=identicon)[Rellix999](/maintainers/Rellix999)

---

Top Contributors

[![rellix999](https://avatars.githubusercontent.com/u/11339048?v=4)](https://github.com/rellix999 "rellix999 (97 commits)")

---

Tags

laravelnotificationrecurringmodalpopupdismissibleserversidedismissiblesdismiss

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rellix-dismissibles-for-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/rellix-dismissibles-for-laravel/health.svg)](https://phpackages.com/packages/rellix-dismissibles-for-laravel)
```

###  Alternatives

[liran-co/laravel-notification-subscriptions

Notification subscription management.

128239.2k1](/packages/liran-co-laravel-notification-subscriptions)[edwardkarlsson/laravel-pushover

A simple, yet very powerful, package that helps you get started with sending push notifications to your iOS or Android device through the pushover.net service.

142.0k](/packages/edwardkarlsson-laravel-pushover)

PHPackages © 2026

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