PHPackages                             monstergfx/menubuilder - 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. monstergfx/menubuilder

ActiveLibrary

monstergfx/menubuilder
======================

A Menu Builder and renderer for Laravel4, Sentry2, and Twitter Bootstrap

v0.1.1beta(12y ago)3451[1 issues](https://github.com/MonsterGfx/L4-Smarty-Menubuilder/issues)BSD-3-ClausePHPPHP &gt;=5.3.0

Since Jul 16Pushed 12y ago1 watchersCompare

[ Source](https://github.com/MonsterGfx/L4-Smarty-Menubuilder)[ Packagist](https://packagist.org/packages/monstergfx/menubuilder)[ Docs](http://github.com/MonsterGfx/L4-Smarty-Menubuilder)[ RSS](/packages/monstergfx-menubuilder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

L4-Smarty-Menubuilder
=====================

[](#l4-smarty-menubuilder)

A Menubuilder for Laravel 4, Twitter Bootstrap, Cartalyst/Sentry 2, and Dark/SmartyView.

Introduction
------------

[](#introduction)

In developing a number of projects using Laravel4, Sentry2, and Smarty, I needed a way to manage menus in the GUI. In the past, I've built menu tables in the database and menu editors, but in general I don't need that level of flexibility (or overhead).

So this time around, I was looking for a way to define my menus in code and generate menus automatically. What I came up with was this Menubuilder, which I am now rebuilding into a package which I will use in multiple projects.

**Note that this project is tailored *very* closely to my requirements and may not be suitable outside of my context.**

Pull requests are welcome. Please note that I am using git flow for my workflow. Don't know what that is? Check out .

Or have a look at one of these screen casts:

- [How to use a scalable Git branching model called git-flow](http://buildamodule.com/video/change-management-and-version-control-deploying-releases-features-and-fixes-with-git-how-to-use-a-scalable-git-branching-model-called-gitflow) (by Build a Module)
- [A short introduction to git-flow](http://vimeo.com/16018419) (by Mark Derricutt)
- [On the path with git-flow](http://codesherpas.com/screencasts/on_the_path_gitflow.mov) (by Dave Bock)

(The links above were found at ).

Usage
-----

[](#usage)

### Defining your menus in code

[](#defining-your-menus-in-code)

Somewhere in your code (it doesn't matter where), define a `menu` by inserting a comment like this:

```
// @menu ||>sort order>

```

or, in a docblock:

```
/**
 * @menu ||>sort order>
 */

```

For example,

```
// @menu Administration|icon-star|5

```

The line above defines a menu with the title "Administration", a Twitter Bootstrap start icon, and a sort order of 5 (ie. it comes after 0, 1, 2, 3, and 4).

Menu items are inserted into your code in a similar way:

```
// @menuitem |||||

```

or

```
 /**
  * @menuitem |||||
  */

```

For example,

```
// @menuitem Administration|List Users|icon-user|list-users|user.list|3

```

This defines a menu item under the "Administration" menu with the text "List Users", a Twitter Bootstrap "user" icon, routes to "list-users", requires the "user.list" permission, and has a sort order of 3.

Taken together, the two examples above give a menu that looks something like this:

```
+------------------+
| * Administration |
+------------------+
| x List Users     |
+------------------+

```

(where the 'x' is the user icon).

### Generating the menus

[](#generating-the-menus)

The menus are generated via an artisan command:

```
php artisan menu:make

```

This command will scan your source files and extract all the `@menu` and `@menuitem` lines, parse them, and write a configuration file: `app/config/menus.php`.

This configuration will then be used at run time to generate menus.

### Using the menubuilder

[](#using-the-menubuilder)

The menubuild provides a method to generate the appropriate menus: `Menubuilder::build()`.

I use it in a default view composer to ensure that the menus are built automatically for each page:

```
View::composer('*',function($view){
	// add the menus (if any)
	$view->with('menus', Menu::build());
	// add other stuff here...
});

```

The `build()` method returns an array that looks something like this:

```
Array
(
    [Administration] => Array
        (
            [icon] => icon-star
            [sort] => 5
            [items] => Array
                (
                    [0] => Array
                        (
                            [text] => List Users
                            [icon] => icon-user
                            [route] => list-users
                            [permission] => user.list
                            [sort] => 1
                        )
                    [1] => Array
                        (
                            [text] => Add New User
                            [icon] => icon-user
                            [route] => create-user
                            [permission] => user.edit
                            [sort] => 1
                        )
                )
        )
)

```

This menu can be passed to a view to be rendered as you see fit.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

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 ~231 days

Total

2

Last Release

4449d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bcd73ae6b607ef30c8dfa54b9e6063d397eff3a35a5916203bd50d97cdca71e5?d=identicon)[MonsterGfx](/maintainers/MonsterGfx)

---

Top Contributors

[![MonsterGfx](https://avatars.githubusercontent.com/u/5022928?v=4)](https://github.com/MonsterGfx "MonsterGfx (23 commits)")

---

Tags

menubootstraplaravel4

### Embed Badge

![Health badge](/badges/monstergfx-menubuilder/health.svg)

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

###  Alternatives

[onokumus/metismenu

A jQuery menu plugin

2.0k263.3k5](/packages/onokumus-metismenu)[kartik-v/yii2-widget-sidenav

An enhanced side navigation menu styled for bootstrap (sub repo split from yii2-widgets)

364.0M8](/packages/kartik-v-yii2-widget-sidenav)[akaunting/laravel-menu

Menu and sidebar management package for Laravel

38233.8k](/packages/akaunting-laravel-menu)[takielias/tablar

Tablar: A Laravel Dashboard Preset Featuring Dark Mode and Dynamic Menu Generation for Effortless Navigation and Fast Development.

30817.7k3](/packages/takielias-tablar)[kalnoy/illuminate-menu

A menu builder for Laravel using Bootstrap's markup.

2514.3k1](/packages/kalnoy-illuminate-menu)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)

PHPackages © 2026

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