PHPackages                             kartik-v/yii2-dialog - 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. kartik-v/yii2-dialog

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

kartik-v/yii2-dialog
====================

An asset bundle for bootstrap3-dialog for Yii 2.0 framework.

v1.0.6(4y ago)496.2M↓12.8%42[2 issues](https://github.com/kartik-v/yii2-dialog/issues)[2 PRs](https://github.com/kartik-v/yii2-dialog/pulls)17BSD-3-ClausePHP

Since Feb 22Pushed 1y ago5 watchersCompare

[ Source](https://github.com/kartik-v/yii2-dialog)[ Packagist](https://packagist.org/packages/kartik-v/yii2-dialog)[ Docs](https://github.com/kartik-v/yii2-dialog)[ RSS](/packages/kartik-v-yii2-dialog/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (1)Versions (8)Used By (17)

 [ ![Krajee Logo](https://camo.githubusercontent.com/4addfbb3869c3fc7d79befea4f06d9cf3655a686fb503df0da1d725859cfdef9/687474703a2f2f6b617274696b2d762e6769746875622e696f2f626f6f7473747261702d66696c65696e7075742d73616d706c65732f73616d706c65732f6b72616a65652d6c6f676f2d622e706e67) ](http://demos.krajee.com "Krajee Demos")
 yii2-dialog ---

 [ ![Donate](https://camo.githubusercontent.com/4af77d425ca202e55ab3d711b438e238ded194735bc345a019ac060e03e26227/687474703a2f2f6b617274696b2d762e6769746875622e696f2f626f6f7473747261702d66696c65696e7075742d73616d706c65732f73616d706c65732f646f6e6174652e706e67) ](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DTP3NZQ6G2AYU "Donate via Paypal")
===============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#------------------------yii2-dialog--------------------)

[![Stable Version](https://camo.githubusercontent.com/613f711c99a3238b819609e699de1672bef67798e60d7c8c987176594a1262b7/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6469616c6f672f762f737461626c65)](https://packagist.org/packages/kartik-v/yii2-dialog)[![Unstable Version](https://camo.githubusercontent.com/2e3d276c9577867e610f55a5a3fcea2d76144550be422653f14575c7874e7e19/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6469616c6f672f762f756e737461626c65)](https://packagist.org/packages/kartik-v/yii2-dialog)[![License](https://camo.githubusercontent.com/8a9384fed8762e036551bfb7aa2f89dc91026c9ccc688e2447471cd8d9617a15/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6469616c6f672f6c6963656e7365)](https://packagist.org/packages/kartik-v/yii2-dialog)[![Total Downloads](https://camo.githubusercontent.com/3ab20756771d4713f4a82ab520ac4216650fb2fcccfc5f4ae1b08c37afbdf4eb/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6469616c6f672f646f776e6c6f616473)](https://packagist.org/packages/kartik-v/yii2-dialog)[![Monthly Downloads](https://camo.githubusercontent.com/e73ebedcba48ed30408c2a07a68b031f0215deb66ae5bab8e7ccf90a8d01011f/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6469616c6f672f642f6d6f6e74686c79)](https://packagist.org/packages/kartik-v/yii2-dialog)[![Daily Downloads](https://camo.githubusercontent.com/6af3e33d1a4210da693b3232ddfb555358f203f6e7ad0cf73d8ee669a32cffa6/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6469616c6f672f642f6461696c79)](https://packagist.org/packages/kartik-v/yii2-dialog)

A widget component for Yii Framework 2.0 to easily configure and initialize popup notification dialog boxes. It provides a polyfill for the native javascript alert, confirm, and prompt dialog boxes. It includes inbuilt support for rendering rich dialog boxes via a customized plugin by Krajee based on and enhanced from [bootstrap3-dialog](http://nakupanda.github.io/bootstrap3-dialog/). This plugin makes using Bootstrap's modal more monkey-friendly. The Krajee enhancements also includes enhanced support for Bootstrap 5.x, 4.x and 3.x. The key features provided by the library are:

- Control how you want to render JAVASCRIPT dialogs. Inbuilt quick support for following dialog types:
    - ALERT dialog
    - CONFIRM dialog
    - PROMPT dialog
    - CUSTOM dialog
- Includes a jQuery plugin `krajeeDialog` (created by Krajee), that allows one to configure the bootstrap3-dialog library easily, or use the native JS alerting component, OR also configure any third party JS Notification Library to be used.
- Ability to render pretty dialogs by overriding and enhancing confirmation dialog for links that use yii's `data-confirm` methods.
- Advanced configuration via `kartik\dialog\Dialog` widget. This widget allows one to globally setup the native JS alert OR bootstrap3-dialog settings.

How to contribute via a pull request?
-------------------------------------

[](#how-to-contribute-via-a-pull-request)

Refer this [git workflow for contributors](.github/GIT-WORKFLOW.md).

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

### Pre-requisites

[](#pre-requisites)

> Note: Check the [composer.json](https://github.com/kartik-v/yii2-dialog/blob/master/composer.json) for this extension's requirements and dependencies. You must set the `minimum-stability` to `dev` in the **composer.json** file in your application root folder before installation of this extension OR if your `minimum-stability` is set to any other value other than `dev`, then set the following in the require section of your composer.json file

```
kartik-v/yii2-dialog: "@dev"

```

Read this [web tip /wiki](http://webtips.krajee.com/setting-composer-minimum-stability-application/) on setting the `minimum-stability` settings for your application's composer.json.

### Release Changes

[](#release-changes)

Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-dialog/blob/master/CHANGE.md) for details of various releases.

### Install

[](#install)

Either run

```
$ php composer.phar require kartik-v/yii2-dialog "@dev"

```

or add

```
"kartik-v/yii2-dialog": "@dev"

```

to the `require` section of your `composer.json` file.

Documentation and Demo
----------------------

[](#documentation-and-demo)

View the [documentation and demos](http://demos.krajee.com/dialog) at Krajee Yii 2 Demos for details on using the extension.

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

In your view you can load the asset bundle and render the javascript to load the bootstrap 3 modal dialog.

```
// view.php
use kartik\dialog\DialogAsset;
DialogAsset::register($this);
$this->registerJs("\$('#your-btn-id').on('click', function(){BootstrapDialog.alert('I want banana!');});");
```

### Advanced Usage (Widget)

[](#advanced-usage-widget)

In your view OR view layout file, you can render the widget like this. This will not display any content directly - but will render all the javascript and css needed for initializing the BootstrapDialog as per your customized settings.

```
use kartik\dialog\Dialog;

// Example 1
echo Dialog::widget([
   'libName' => 'krajeeDialog',
   'options' => [], // default options
]);

// Example 2
echo Dialog::widget([
   'libName' => 'krajeeDialogCust',
   'options' => ['draggable' => true, 'closable' => true], // custom options
]);
```

Then in your view, you can write your own javascript to render your alert, confirm, and prompt boxes (or a custom dialog box). For example on click of HTML buttons `btn-1` and `btn-2`, the dialogs can be popped up as shown below:

```
// NOTE: This is a javascript code and must be run in Yii via 'registerJs'
//       or via a JS File in an AssetBundle

// use krajeeDialog object instance initialized by the widget
$('#btn-1').on('click', function() {
    krajeeDialog.alert('An alert');
    // or show a confirm
    krajeeDialog.confirm('Are you sure', function(out){
        if(out) {
            alert('Yes'); // or do something on confirmation
        }
    });
});

// use krajeeDialogCust object instance
$('#btn-2').on('click', function() {
    krajeeDialogCust.alert('An alert');
    // or show a prompt
    krajeeDialogCust.prompt({label:'Provide reason', placeholder:'Upto 30 characters...'}, function(out){
        if (out) {
            alert('Yes'); // or do something based on the value of out
        }
    });
});
```

### Overriding Yii's Confirmation Dialog

[](#overriding-yiis-confirmation-dialog)

Yii renders the native confirmation dialog on links that are rendered by setting `data-confirm` property on links. This widget enhances and beautifies the native confirmation dialog using Krajee Dialog. This behavior can be controlled via the `overrideYiiConfirm`property which defaults to `true`. This can be useful in rendering links and action buttons like the GridView ActionColumn delete button.

```
// the rendered link will automatically show a Krajee Dialog Confirmation dialog
use kartik\dialog\Dialog;
echo Dialog::widget(['overrideYiiConfirm' => true]);
echo Html::a(
    'Delete',
    ['/item/delete', 'id' => $model->id],
    [
        'data-confirm' => 'Are you sure to delete this item?'
        'data-method' => 'post'
    ]
);
```

License
-------

[](#license)

**yii2-dialog** is released under the BSD 3-Clause License. See the bundled `LICENSE.md` for details.

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity59

Moderate usage in the ecosystem

Community37

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 69.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 ~336 days

Recently: every ~353 days

Total

7

Last Release

1720d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3592619?v=4)[Kartik Visweswaran](/maintainers/kartik-v)[@kartik-v](https://github.com/kartik-v)

---

Top Contributors

[![kartik-v](https://avatars.githubusercontent.com/u/3592619?v=4)](https://github.com/kartik-v "kartik-v (58 commits)")[![doston92](https://avatars.githubusercontent.com/u/30181012?v=4)](https://github.com/doston92 "doston92 (3 commits)")[![kenjebaev](https://avatars.githubusercontent.com/u/20373911?v=4)](https://github.com/kenjebaev "kenjebaev (2 commits)")[![devkpv](https://avatars.githubusercontent.com/u/489952?v=4)](https://github.com/devkpv "devkpv (2 commits)")[![DumpOfTheVar](https://avatars.githubusercontent.com/u/4920070?v=4)](https://github.com/DumpOfTheVar "DumpOfTheVar (2 commits)")[![fetus-hina](https://avatars.githubusercontent.com/u/848666?v=4)](https://github.com/fetus-hina "fetus-hina (1 commits)")[![IgorCode](https://avatars.githubusercontent.com/u/5962736?v=4)](https://github.com/IgorCode "IgorCode (1 commits)")[![jaehter](https://avatars.githubusercontent.com/u/11258837?v=4)](https://github.com/jaehter "jaehter (1 commits)")[![koxu1996](https://avatars.githubusercontent.com/u/6506780?v=4)](https://github.com/koxu1996 "koxu1996 (1 commits)")[![lourdas](https://avatars.githubusercontent.com/u/397916?v=4)](https://github.com/lourdas "lourdas (1 commits)")[![mingchi21](https://avatars.githubusercontent.com/u/5524298?v=4)](https://github.com/mingchi21 "mingchi21 (1 commits)")[![mortezakarimi](https://avatars.githubusercontent.com/u/4004087?v=4)](https://github.com/mortezakarimi "mortezakarimi (1 commits)")[![mskayali](https://avatars.githubusercontent.com/u/9249493?v=4)](https://github.com/mskayali "mskayali (1 commits)")[![sjjliqpl](https://avatars.githubusercontent.com/u/2384679?v=4)](https://github.com/sjjliqpl "sjjliqpl (1 commits)")[![SkullyDev](https://avatars.githubusercontent.com/u/7769743?v=4)](https://github.com/SkullyDev "SkullyDev (1 commits)")[![bmsrox](https://avatars.githubusercontent.com/u/3869640?v=4)](https://github.com/bmsrox "bmsrox (1 commits)")[![yepes](https://avatars.githubusercontent.com/u/1114453?v=4)](https://github.com/yepes "yepes (1 commits)")[![boliver20](https://avatars.githubusercontent.com/u/3207245?v=4)](https://github.com/boliver20 "boliver20 (1 commits)")[![Edofre](https://avatars.githubusercontent.com/u/710429?v=4)](https://github.com/Edofre "Edofre (1 commits)")[![enricodetoma](https://avatars.githubusercontent.com/u/464156?v=4)](https://github.com/enricodetoma "enricodetoma (1 commits)")

---

Tags

yii2extensionbootstrapmodalalertdialog

### Embed Badge

![Health badge](/badges/kartik-v-yii2-dialog/health.svg)

```
[![Health](https://phpackages.com/badges/kartik-v-yii2-dialog/health.svg)](https://phpackages.com/packages/kartik-v-yii2-dialog)
```

###  Alternatives

[kartik-v/yii2-date-range

An advanced Yii 2 date range picker input for based on bootstrap-daterangepicker plugin.

894.4M42](/packages/kartik-v-yii2-date-range)[kartik-v/yii2-helpers

A collection of useful helper functions for Yii Framework 2.0

883.0M29](/packages/kartik-v-yii2-helpers)[kartik-v/yii2-widget-rating

A Yii2 widget for the simple yet powerful bootstrap-star-rating plugin with fractional rating support (sub repo split from yii2-widgets)

444.1M8](/packages/kartik-v-yii2-widget-rating)[kartik-v/yii2-widget-timepicker

Enhanced Yii2 wrapper for the bootstrap timepicker plugin (sub repo split from yii2-widgets)

404.9M14](/packages/kartik-v-yii2-widget-timepicker)[kartik-v/yii2-sortable

Create sortable lists and grids using HTML5 drag and drop API for Yii 2.0.

433.8M13](/packages/kartik-v-yii2-sortable)[kartik-v/yii2-widget-switchinput

A Yii2 wrapper widget for the Bootstrap Switch plugin to use checkboxes &amp; radios as toggle switchinputes (sub repo split from yii2-widgets)

384.4M13](/packages/kartik-v-yii2-widget-switchinput)

PHPackages © 2026

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