A nice Menu builder for PHP.
To install it, use composer:
composer require lavary/menus
You can create a menu by calling make()
method.
Here's a basic usage:
<?php
use Lavary\Menus\MenuBuilder;
$builder = new MenuBuilder();
$builder->make('MyNavBar', function($menu) {
$menu->add('Home');
$menu->add('About', ['url' => 'about', 'class' => 'foo bar', 'data-role' => 'item'])->data('weight', 15);
$menu->about->add('Goals', 'about/goals');
$menu->add('services', 'services');
$menu->add('Contact', 'contact');
});
echo $builder->get('myNavBar')->asBootstrap(['navbar-inverse']);
// or
echo $builder->get('myNavBar')->asUl();
Please checkout the documentation to learn about all the features.
Please submit all issues and questions using GitHub issues and I will try to help you.
Menus is free software distributed under the terms of the MIT license.