Yii 2.0: yii2-menu

Creating links, drop menus, line (diver) in the navbar-left and/or navbar-right

Menu menager for Yii2

Menu builder DEMO


  • Creating and menagment navbar-left and/or navbar-right
  • Sorting, editing, and deleting elements using drag and drop method
  • CRUD operations by jQuery Ajax)
  • No jQuery for drag and drop (RubaXa/Sortable)


composer require pceuropa/yii2-menu dev-master

Add the following code to config file Yii2 (config/web.php or exp. config/main.php)

'modules' => [
    'menu' => [
            'class' => '\pceuropa\menu\Module',


1. Create database schema (table menu)

Make sure that you have properly configured db application component and run the following command:

$ php yii migrate/up --migrationPath=@vendor/pceuropa/yii2-menu/migrations

2. Add the following code to config file Yii2

use pceuropa\menu\Menu;
NavBar::begin(['brandLabel' => 'Brand','brandUrl' => Url::home(),]);
echo Nav::widget([ 'options' => ['class' => 'navbar-nav navbar-left'],
                    'items' => Menu::NavbarLeft(1)  // argument is id of menu
echo Nav::widget([ 'options' => ['class' => 'navbar-nav navbar-right'],
                    'items' => Menu::NavbarRight(1)

Author: Rafal Marguzewicz| Donation

Total 2 comments

#20011 report it
pceuropa at 2017/01/07 04:21am
in v2.0.7 fix this bug

All reported bugs fixed

#19936 report it
PaulD at 2016/08/25 02:44pm
Error in code.

Installed.. ran the migration, when I go to the /menu url I get the following php error

syntax error, unexpected '.', expecting ',' or ';'

in G:\webroot2\yii2app\advanced_protected\vendor\pceuropa\yii2-menu\MenuAsset.php at line 8

I looked at that line. It appears fins so something prior to that is bad.

Platform is Windows 10 / Apache 2 PHP 5.5 Yii2

Leave a comment

Please to leave your comment.

Create extension
No downloadable files yet