PHPackages                             anlutro/menu - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. anlutro/menu

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

anlutro/menu
============

Dynamic menu builder.

0.6.2(10y ago)191.7k2[4 issues](https://github.com/anlutro/php-menu/issues)[1 PRs](https://github.com/anlutro/php-menu/pulls)1MITPHPPHP &gt;=5.4.0

Since Feb 22Pushed 8y ago4 watchersCompare

[ Source](https://github.com/anlutro/php-menu)[ Packagist](https://packagist.org/packages/anlutro/menu)[ RSS](/packages/anlutro-menu/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (22)Used By (1)

Menu Builder [![Build Status](https://camo.githubusercontent.com/1e61fb2ff2b879f6c70ee11aad22d1afbddc44c704cd4ef035e82090d011087b/68747470733a2f2f7472617669732d63692e6f72672f616e6c7574726f2f7068702d6d656e752e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/anlutro/php-menu) [![Latest Version](https://camo.githubusercontent.com/21d49e9a8a2dd0cc9b5dae7e9ddf5f3f57ccd7ed8e778b32dc1befbb89b316ca/687474703a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f616e6c7574726f2f7068702d6d656e752e737667)](https://github.com/anlutro/php-menu/releases)
==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#menu-builder---)

Simple dynamic menu building system.

PHP framework agnostic. The default renderer uses Bootstrap 3 class names and markup.

Installation
------------

[](#installation)

`composer require anlutro/menu` - pick the latest tag visible in the github tag list or on packagist.

#### Laravel 4

[](#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.

Do `artisan config:publish anlutro/menu` to change the default Bootstrap 3-specific settings.

Usage
-----

[](#usage)

Set up a shared instance of Menu\\Builder. Create the menus you need.

```
$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.

From here, you can add items to your menus from anywhere.

```
$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.

```
$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.

```
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)`.

Contact
-------

[](#contact)

Open an issue on GitHub if you have any problems or suggestions.

License
-------

[](#license)

The contents of this repository is released under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~33 days

Recently: every ~111 days

Total

20

Last Release

3837d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/48f62855097c02888b96494da9a389988cd7ecb9001465f8ec30f15672fb5b5a?d=identicon)[anlutro](/maintainers/anlutro)

---

Top Contributors

[![anlutro](https://avatars.githubusercontent.com/u/163093?v=4)](https://github.com/anlutro "anlutro (48 commits)")

### Embed Badge

![Health badge](/badges/anlutro-menu/health.svg)

```
[![Health](https://phpackages.com/badges/anlutro-menu/health.svg)](https://phpackages.com/packages/anlutro-menu)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
