lavary/menus

Create menus in your PHP application in no time

v0.1.0 2016-11-13 12:31 UTC

This package is auto-updated.

Last update: 2024-10-21 01:17:30 UTC


README

A nice Menu builder for PHP.

Version Build

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.

If You Need Help

Please submit all issues and questions using GitHub issues and I will try to help you.

License

Menus is free software distributed under the terms of the MIT license.