PHPackages                             qstart-soft/html-modal - 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. qstart-soft/html-modal

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

qstart-soft/html-modal
======================

The Html-Modal component

v1.0.1(3y ago)140MITPHPPHP &gt;=8.0

Since Jun 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/qstart-soft/html-modal)[ Packagist](https://packagist.org/packages/qstart-soft/html-modal)[ RSS](/packages/qstart-soft-html-modal/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Html Modal Component
====================

[](#html-modal-component)

The Html-Modal component provides all the tools needed to build modal windows, independent of the rest of the system.

It provides the infrastructure to separate modal processing logic from the rest of the view.

On the frontend, you can use any convenient library

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

[](#installation)

```
$ composer require qstart-soft/html-modal

```

Getting Started
---------------

[](#getting-started)

First you need to create a container instance of [AbstractModalContainer](https://github.com/qstart-soft/html-modal/blob/main/AbstractModalContainer.php) for working with modal windows.

The container uses two types of attributes:

***[ModalName](https://github.com/qstart-soft/html-modal/blob/main/ModalName.php)***

It is passes a list of modal window names for which the method is used.

***[ModalBuilderMethod](https://github.com/qstart-soft/html-modal/blob/main/ModalBuilderMethod.php)***

is used to set the method in which the content is wrapped if needed. This attribute can be set in two ways

- globally for the whole class
- for a specific method

You can also exclude a method from wrapper processing in the following way: #\[ModalBuilderMethod(ModalBuilderMethod::EMPTY\_BUILDER)\]

```
use Qstart\HtmlModal\AbstractModalContainer;
use Qstart\HtmlModal\ModalBuilderMethod;
use Qstart\HtmlModal\ModalName;

#[ModalBuilderMethod('buildModal')]
class ModalContainer extends AbstractModalContainer
{
    #[ModalName('first-modal', 'second-modal')]
    public function viewFirstModal($modalId, $modalName)
    {
        return $this->templating->render('modal-template');
    }

    #[ModalName('another-modal')]
    #[ModalBuilderMethod(ModalBuilderMethod::EMPTY_BUILDER)]
    public function viewAnotherModal($modalId, $modalName)
    {
        return $this->templating->render('another-modal-template');
    }

    public function buildModal($content)
    {
        // For example with Bootstrap Modal Component
        return sprintf(
        '

                Modal title

              %s

        ',
        $content
        );
    }
}
```

Then, once you have the container with the required logic, we can set up the controller.

Let's say a request comes into a `ModalController` in an action named `show`.

We need to set up a configuration object and build a modal window. You can do this as an example:

To connect the engine to work with templates, the library is used [Symfony Templating Component](https://packagist.org/packages/symfony/templating)

```
use Qstart\HtmlModal\ModalBuilder;
use Qstart\HtmlModal\ModalConfig;
use Symfony\Component\Templating\PhpEngine;

class ModalController
{
    public function actionShow(PhpEngine $templating, $modalName, $modalId = null)
    {
        $config = new ModalConfig(new ModalContainer(), $templating);
        // Additional containers are connected by the following method:
        $config->setContainers([]);

        $builder = new ModalBuilder($config, $modalName, $modalId);
        $content = $builder->getContent();

        return $content;
    }
}
```

***Wonderful!***

We've separated the modal rendering logic from the rest of the view. On the frontend, you can use any convenient library

Resources
---------

[](#resources)

- [Symfony Templating Component](https://packagist.org/packages/symfony/templating)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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 ~0 days

Total

2

Last Release

1428d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/46ff887eb5d499136fe3d3a4a49754a2a88e74cba7ff9ce61a10b237192c9bd6?d=identicon)[qstart](/maintainers/qstart)

---

Top Contributors

[![sgostev](https://avatars.githubusercontent.com/u/182699962?v=4)](https://github.com/sgostev "sgostev (4 commits)")[![qstart-soft](https://avatars.githubusercontent.com/u/60501939?v=4)](https://github.com/qstart-soft "qstart-soft (1 commits)")

---

Tags

htmlmodal

### Embed Badge

![Health badge](/badges/qstart-soft-html-modal/health.svg)

```
[![Health](https://phpackages.com/badges/qstart-soft-html-modal/health.svg)](https://phpackages.com/packages/qstart-soft-html-modal)
```

###  Alternatives

[wire-elements/modal

Laravel Livewire modal component

1.2k3.8M31](/packages/wire-elements-modal)[spatie/laravel-html

A fluent html builder

8376.4M72](/packages/spatie-laravel-html)[ckeditor/ckeditor

JavaScript WYSIWYG web text editor.

5234.2M76](/packages/ckeditor-ckeditor)[caxy/php-htmldiff

A library for comparing two HTML files/snippets and highlighting the differences using simple HTML.

21520.9M15](/packages/caxy-php-htmldiff)[yajra/laravel-datatables-html

Laravel DataTables HTML builder plugin

2899.6M48](/packages/yajra-laravel-datatables-html)[wa72/htmlpagedom

jQuery-inspired DOM manipulation extension for Symfony's Crawler

3383.9M34](/packages/wa72-htmlpagedom)

PHPackages © 2026

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