PHP code example of vanquyet / yii2-menu

1. Go to this page and download the library: Download vanquyet/yii2-menu 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/ */

    

vanquyet / yii2-menu example snippets


use vanquyet\menu\Menu;
$menu = new Menu();
$menu->init(
    [
        'info' => [
            'homePage' => [
                'label' => 'Trang chủ',
                'url' => Url::home(true),
                'parentKey' => null
            ],
            'aboutPage' => [
                'label' => 'Giới thiệu',
                'url' => Url::to(['site/about'], true),
                'parentKey' => null
            ],
            'teachers' => [
                'label' => 'Giáo viên',
                'url' => '#',
                'parentKey' => 'aboutPage'
            ]
        ]
    ]
);

var_dump($menu->getRootItems());

php composer.phar