PHPackages                             mrjokermr/dynamic-modal-wrapper - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mrjokermr/dynamic-modal-wrapper

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mrjokermr/dynamic-modal-wrapper
===============================

Scaffholding for laravel &amp; livewire modals

v1.0.4(7mo ago)0152MITPHPPHP &gt;=8.1

Since Sep 11Pushed 7mo agoCompare

[ Source](https://github.com/mrjokermr/dynamic-modal-wrapper)[ Packagist](https://packagist.org/packages/mrjokermr/dynamic-modal-wrapper)[ RSS](/packages/mrjokermr-dynamic-modal-wrapper/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (6)Dependencies (2)Versions (7)Used By (0)

Dynamic modal wrapper
=====================

[](#dynamic-modal-wrapper)

A lightweight package that brings simple, dynamic modal handling to Livewire 3. It provides a clean way to open and close modals from anywhere in your application without boilerplate logic, while keeping configuration and customization flexible.

With DynamicModalWrapper you can:

- Dispatch modals dynamically from your Livewire components.
- Pass parameters to modal components at runtime.
- Hook into modal lifecycle events (`OPEN_EVENT`, `CLOSING_EVENT`, `CLOSE_EVENT`).
- Customize modal appearance (background colors, padding, z-index, press escape-to-close) via a publishable config.

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

[](#installation)

Install via composer:

```
  composer require mrjokermr/dynamic-modal-wrapper
```

Place the Livewire component right after the opening body tag in your layout (for example in `resources/views/layouts/app.blade.php`)

```

@livewire('dynamic-modal-wrapper')

```

Usage/Examples
--------------

[](#usageexamples)

```
use Mrjokermr\DynamicModalWrapper\Dtos\OpenModalDto;
use Mrjokermr\DynamicModalWrapper\Livewire\DynamicModalWrapper;

$this->dispatch(
    DynamicModalWrapper::OPEN_EVENT,
    new OpenModalDto(
        livewireClass: CreateProductModal::class,
    )
);
```

**Passing data to the mount function:**

```
use Mrjokermr\DynamicModalWrapper\Dtos\OpenModalDto;
use Mrjokermr\DynamicModalWrapper\Livewire\DynamicModalWrapper;

$this->dispatch(
    DynamicModalWrapper::OPEN_EVENT,
    new OpenModalDto(
        livewireClass: CreateProductModal::class,
        params: ['id' => 12]
    )
);
```

You might want to set the `OpenModalDto` name since this name will be sent with the php`DynamicModalWrapper::CLOSING_EVENT` event for implementing custom logic before the livewire component will be broken down. **example**

```
use Mrjokermr\DynamicModalWrapper\Dtos\OpenModalDto;
use Mrjokermr\DynamicModalWrapper\Livewire\DynamicModalWrapper;

function open()
{
    $this->dispatch(
        DynamicModalWrapper::OPEN_EVENT,
        (new OpenModalDto(
            livewireClass: CreateProductModal::class,
            params: ['id' => 12],
        ))->setName(name: 'create-product-modal')
    );
}

class CreateProductModal extends Component
{
    public function mount(int $id)
    {
        //...
    }
}
```

You might also want to set the `OpenModalDto` content background color to another color then the set `default_content_wrapper_background_color_hex` config value. **example**

```
use Mrjokermr\DynamicModalWrapper\Dtos\OpenModalDto;
use Mrjokermr\DynamicModalWrapper\Livewire\DynamicModalWrapper;

$this->dispatch(
    DynamicModalWrapper::OPEN_EVENT,
    (new OpenModalDto(
        livewireClass: CreateProductModal::class,
        params: ['id' => 12]
    ))->setContentBackgroundColorHex(hexColor: '#292929') //hexColor: '292929' is also valid
);
```

The package dispatches a closing event once the `DynamicModalWrapper::CLOSE_EVENT` has been triggered, before completion:

```
$this->dispatch(self::CLOSING_EVENT, name: $modal->name ?? $modal->getId());
```

Available events:

```
use Mrjokermr\DynamicModalWrapper\Livewire\DynamicModalWrapper;

DynamicModalWrapper::OPEN_EVENT,
DynamicModalWrapper::CLOSE_EVENT,
DynamicModalWrapper::CLOSING_EVENT, //will be dispatched before closing the modal, and dispatched the optionally set ->setName(name: 'modal-name') name.
```

### Config

[](#config)

```
php artisan vendor:publish --tag=dynamic-modal-wrapper-config
```

**default config:**

```
return [
    'default_content_padding' => '1.25rem', //can be set to any CSS accepted value. Also nullable
    'escape_to_close' => true, //when the user presses the ESC button the shown modal will be closed
    'default_content_wrapper_background_color_hex' => '#ffffff', //color used for wrapping the Livewire modal content
    'wrapper_background_color_hex' => '#bdbdbd33', //color used in combination with the backdrop blur.

    'z-index' => 100, //used by the dynamic modal container
];
```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance64

Regular maintenance activity

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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 ~13 days

Total

6

Last Release

217d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7845f8d4cf31aad673788f67a97179d31c8b8eb2490c431f979196ad4a46b741?d=identicon)[mrjokermr](/maintainers/mrjokermr)

---

Top Contributors

[![mrjokermr](https://avatars.githubusercontent.com/u/46922309?v=4)](https://github.com/mrjokermr "mrjokermr (11 commits)")

### Embed Badge

![Health badge](/badges/mrjokermr-dynamic-modal-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/mrjokermr-dynamic-modal-wrapper/health.svg)](https://phpackages.com/packages/mrjokermr-dynamic-modal-wrapper)
```

###  Alternatives

[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21255.6k](/packages/ramonrietdijk-livewire-tables)[lakm/laravel-comments

Integrate seamless commenting functionality into your Laravel project.

40614.3k1](/packages/lakm-laravel-comments)[team-nifty-gmbh/tall-datatables

Server-side rendered datatables for Laravel and Livewire

1319.7k3](/packages/team-nifty-gmbh-tall-datatables)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.2k](/packages/tomshaw-electricgrid)[marcorieser/statamic-livewire

A Laravel Livewire integration for Statamic.

23100.9k12](/packages/marcorieser-statamic-livewire)

PHPackages © 2026

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