1. Go to this page and download the library: Download tlr/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/ */
$headerMenu = $repo->menu( 'header-nav' ); // will use the existing menu instance cached with this key
$newMenu = $repo->menu( 'other-nav' ); // that key hasn't been used yet, so a new instance will be created and cached with that key
// This will filter the items based on user permissions
$menu->getItems(function($item) use ($user)
{
return $user->can( $item->option( 'permissions', array() ) );
});
// This will add a filter that only lets the given user see the menu items if they have the appropriate auth level
$menu->addFilter(function($item) use ($user)
{
return $item->option('auth') <= $user->authLevel;
});
$menu->getItems();