1. Go to this page and download the library: Download bkoetsier/navigation 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/ */
//with Laravel
// set the current active item-id, maybe from a url or db
Nav::setCurrent(2);
Nav::menu('main')->render();
//without Laravel
$nav->setCurrent(2);
$nav->menu('main')->render();
Nav::setCurrent()
Nav::menu('main')->setCurrent(1)->setMaxLevel(1);
Nav::menu('sub')->setCurrent(2);
//will render until level == 1 from id 1 down
Nav::menu('main')->render();
// will render from id 2 down until the end
Nav::menu('sub')->render();