2017 © Pedro Peláez
 

library menu

Dynamic menu builder.

image

anlutro/menu

Dynamic menu builder.

  • Thursday, November 12, 2015
  • by anlutro
  • Repository
  • 4 Watchers
  • 19 Stars
  • 1,362 Installations
  • PHP
  • 1 Dependents
  • 1 Suggesters
  • 3 Forks
  • 5 Open issues
  • 22 Versions
  • 1 % Grown

The README.md

Menu Builder Build Status Latest Version

Simple dynamic menu building system., (*1)

PHP framework agnostic. The default renderer uses Bootstrap 3 class names and markup., (*2)

Installation

composer require anlutro/menu - pick the latest tag visible in the github tag list or on packagist., (*3)

Laravel 4

Add anlutro\Menu\ServiceProvider to the list of providers in app/config/app.php. Optionally, add an alias for 'Menu' => 'anlutro\Menu\Facade' as well. The menu builder instance can be accessed via the facade or via automatic dependency injection by type hinting., (*4)

Do artisan config:publish anlutro/menu to change the default Bootstrap 3-specific settings., (*5)

Usage

Set up a shared instance of Menu\Builder. Create the menus you need., (*6)

$builder = new anlutro\Menu\Builder;
$menu = $builder->createMenu('left');

If you're using Laravel 4, you can use Menu:: instead of $builder-> provided you set up an alias as shown in the installation instructions above., (*7)

From here, you can add items to your menus from anywhere., (*8)

$menu->addItem('Item 1', '/my-uri');

// you can add custom html attributes to your items
$menu->addItem('Item 2', '/my-uri', ['class' => 'custom-class']);

// use priorities to push items to the top or bottom of your menu
// items have priority 0 by default.
$menu->addItem('First item', '/my-uri', [], -50);
$menu->addItem('Last item', '/my-uri', [], 50);

Adding submenus works similarly., (*9)

$submenu = $menu->addSubmenu('Sub Menu');
$submenu->addItem('Sub item 1', '/my-uri');

When you want to render a menu, call render($menu) and echo it., (*10)

echo $builder->render('left');

By default, Bootstrap 3-specific classes are used. If you want to use something else, you need to create your own class implementation of anlutro\Menu\Renderers\RendererInterface and either do $builder->setDefaultRenderer('MyRenderer') or $builder->render('name_of_menu', $myRenderer)., (*11)

Contact

Open an issue on GitHub if you have any problems or suggestions., (*12)

License

The contents of this repository is released under the MIT license., (*13)

The Versions

12/11 2015

dev-master

9999999-dev

Dynamic menu builder.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Andreas Lutro

12/11 2015

0.6.2

0.6.2.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Andreas Lutro

25/08 2015

dev-develop

dev-develop

Dynamic menu builder.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Andreas Lutro

25/08 2015

0.6.1

0.6.1.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Andreas Lutro

03/04 2015

0.6.0

0.6.0.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Andreas Lutro

31/10 2014

0.5.2

0.5.2.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

25/08 2014

0.5.1

0.5.1.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

28/07 2014

0.5.0

0.5.0.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

04/07 2014

0.4.1

0.4.1.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

25/06 2014

0.4.0

0.4.0.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

25/06 2014

0.3.2

0.3.2.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

13/05 2014

0.3.1

0.3.1.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

04/05 2014

0.3.0

0.3.0.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

29/04 2014

0.2.2

0.2.2.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

14/04 2014

0.2.1

0.2.1.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

14/04 2014

0.2.0

0.2.0.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

25/03 2014

0.1.5

0.1.5.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

04/03 2014

0.1.4

0.1.4.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

03/03 2014

0.1.3

0.1.3.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

26/02 2014

0.1.2

0.1.2.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

22/02 2014

0.1.1

0.1.1.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro

22/02 2014

0.1.0

0.1.0.0

Dynamic menu builder.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Lutro