PHPackages                             antonyz89/yii2-mdbootstrap - 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. antonyz89/yii2-mdbootstrap

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

antonyz89/yii2-mdbootstrap
==========================

Material Design Bootstrap 5 for Yii2

1.0.3(1y ago)2398↓100%[1 issues](https://github.com/AntonyZ89/yii2-mdbootstrap/issues)MITPHPPHP &gt;=7.2

Since May 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/AntonyZ89/yii2-mdbootstrap)[ Packagist](https://packagist.org/packages/antonyz89/yii2-mdbootstrap)[ RSS](/packages/antonyz89-yii2-mdbootstrap/feed)WikiDiscussions main Synced 1mo ago

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

Yii2 - Material Design Bootstrap 5
==================================

[](#yii2---material-design-bootstrap-5)

Material Design Bootstrap 5 for Yii2

Installation
============

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist antonyz89/yii2-mdb "*"
```

or add

```
"antonyz89/yii2-mdb": "*"

```

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

Usage
=====

[](#usage)

1. add `MDBootstrapPluginAsset::class` and `MDBootstrapAsset::class` to your `AppAsset::class`

```
use antonyz89\mdb\MDBootstrapAsset;
use yii\web\YiiAsset;

class AppAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';

    public $css = [];
    public $js = [];
    public $depends = [
        // ...
        MDBootstrapPluginAsset::class, // 1st
        MDBootstrapAsset::class,       // 2nd
    ];
}
```

i18n
----

[](#i18n)

add in `common\config\main.php`

```
return [
    ...
    'components' => [
       ...
       'i18n' => [
            'translations' => [
                'mdb' => [
                    'class' => PhpMessageSource::class,
                    'basePath' => '@antonyz89/mdb/messages',
                ],
            ],
        ],
    ]
];
```

Modal
-----

[](#modal)

- Close modal after submit
- Callback after submit

**⚠️ IMPORTANT:**

- `modal=1` is added to URL when submit is triggered on modal to ignore ajax validation requests and save your model successfully.
- `data-callback` attribute is required even you don't wan't use a callback ( in this case use `callback=null`, `data-callback=false` or something else ). This is because when an `` tag is clicked with `data-callback` attribute will add an `data-ajax=1` on your form to do submit via ajax and close modal when you return `{ success: true }`

```
