PHP code example of kolyasiryk / yii2-menu-mongo

1. Go to this page and download the library: Download kolyasiryk/yii2-menu-mongo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kolyasiryk / yii2-menu-mongo example snippets



class MenuController extends Controller
{
    use MenuTrait;
}

class MenuItemController extends Controller
{
    use MenuItemTrait;
}


<?= MenuWidget::widget([
    'menuName' => 'main_footer',
    'menuWrapper' => '<ul class="bottom-nav">{items}</ul>',
]) 

<?= MenuWidget::widget([
    'menuName' => 'main_header',
    'template' => function (MenuItem $current) {
        return Html::tag('li', Html::a($current->title, $current->url) . '{children}', [
            'class' => ($current->url == Url::to([''])) ? 'active' : '',
        ]);
    },
    'menuWrapper' => '<nav class="nav-holder"><ul id="nav">{items}</ul></nav>',
    'subMenuWrapper' => '<div class="drop"><ul>{items}</ul></div>',
]) 

php composer.phar