1. Go to this page and download the library: Download gourmet/knp-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/ */
gourmet / knp-menu example snippets
\Cake\Core\Plugin::load('Gourmet/KnpMenu');
public $components = ['Gourmet/KnpMenu.Menu'];
public $helpers = ['Gourmet/KnpMenu.Menu'];
$menu = $this->Menu->get('my_menu');
// using an array for URL and child's name as title
$menu->addChild('Dashboard', ['uri' => ['controller' => 'Users', 'action' => 'dashboard']]);
// using a named route for URL and custom title
$menu->addChild('Dashboard', ['route' => 'dashboard', 'label' => 'My Account']);
// by default, renders as a list
echo $this->Menu->render('my_menu');