PHPackages                             it-yakutia/yii2-materialadmin - 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. [Framework](/categories/framework)
4. /
5. it-yakutia/yii2-materialadmin

ActiveYii2-extension[Framework](/categories/framework)

it-yakutia/yii2-materialadmin
=============================

Material Admin module for Yii2

v1.0.7(3y ago)0345MITJavaScript

Since Apr 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/IT-Yakutia/yii2-materialadmin)[ Packagist](https://packagist.org/packages/it-yakutia/yii2-materialadmin)[ RSS](/packages/it-yakutia-yii2-materialadmin/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (6)Versions (15)Used By (0)

Material Admin module for Yii2
==============================

[](#material-admin-module-for-yii2)

Material Admin module 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 it-yakutia/yii2-materialadmin "*"
```

or add

```
"it-yakutia/yii2-materialadmin": "*"
```

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

Usage
-----

[](#usage)

Once the extension is installed, simply add in your `backend` config:

```
    ...
    'layoutPath' => '@vendor/it-yakutia/yii2-materialadmin/src/views/layouts',
    'components' => [
        ...
    ],
```

Once the extension is installed, use this `SiteController` for `backend`:

```
/**
 * Site controller
 */
class SiteController extends Controller
{
    /**
     * {@inheritdoc}
     */
    public function behaviors()
    {
        return [
            'access' => [
                'class' => AccessControl::className(),
                'rules' => [
                    [
                        'actions' => ['login', 'error'],
                        'allow' => true,
                    ],
                    [
                        'actions' => ['logout', 'index'],
                        'allow' => true,
                        'roles' => ['@'],
                    ],
                ],
            ],
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'logout' => ['post'],
                ],
            ],
        ];
    }

    /**
     * @inheritdoc
     */
    public function actions()
    {
        return [
            'error' => [
                'class' => 'yii\web\ErrorAction',
                'layout' => 'empty'
            ],
        ];
    }

    /**
     * Displays homepage.
     *
     * @return string
     */
    public function actionIndex()
    {
        return $this->render('index');
    }

    public function actionLogin()
    {
        return $this->redirect(['/materialadmin/profile/login']);
    }
}
```

Once the extension is installed, simply add in your `console` config:

```
    'controllerMap' => [
        ...
        'faker' => [
            'class' => \ityakutia\materialadmin\commands\FakerController::class,
        ],
        'migrate' => [
            'class' => MigrateController::class,
            'migrationPath' => [
                ...
                '@ityakutia/materialadmin/migrations',
            ],
        ],
    ]
```

create your custom navitems for `@backend/views/layout/_sidenav`:

```

    public
