PHPackages                             thepsion5/menuizer - 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. [Templating &amp; Views](/categories/templating)
4. /
5. thepsion5/menuizer

ActiveLibrary[Templating &amp; Views](/categories/templating)

thepsion5/menuizer
==================

A package for conveniently creating and rendering menu templates

18PHP

Since May 19Pushed 12y ago2 watchersCompare

[ Source](https://github.com/thepsion5/menuizer)[ Packagist](https://packagist.org/packages/thepsion5/menuizer)[ RSS](/packages/thepsion5-menuizer/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (2)Used By (0)

Menuizer
========

[](#menuizer)

[![Build Status](https://camo.githubusercontent.com/c9676bb32647582fc3c1635c1761a4fa1e4a5d452ce7c0e5e29e0f4b96881618/68747470733a2f2f7472617669732d63692e6f72672f7468657073696f6e352f6d656e75697a65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/thepsion5/menuizer.svg?branch=master)

[![Coverage Status](https://camo.githubusercontent.com/f6f9afcc79afa7c7d09fdae108cf6adadd14990b0fef4b3ed72ef4d12c647d32/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7468657073696f6e352f6d656e75697a65722f62616467652e706e67)](https://coveralls.io/r/thepsion5/menuizer)

- [Installation](#installation)
- [Getting Started](#getting-started)
- [Basic Usage](#basic-usage)
- [Available Menu Rules](#available-menu-rules)
- [Rule Shortcuts](#rule-shortcuts)
- [Advanced Usage](#advanced-usage)
- [Todo](#todo)

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

[](#installation)

Add `thepsion5/menuizer` as a requirement to your `composer.json`:

```
{
    "require": {
        "thepsion5/menuizer" : "dev-master"
    }
}
```

Then run `composer update` or `composer install`

\##Getting Started

\###Vanilla PHP Menuizer provides a convenient factory method to create a new instance of the service

```
$menuizer = Thepsion5\Menuizer\MenuizerService::create();
```

\###Laravel First, add Menuizer's service provider to the array of providers in `app/config/app.php`:

```
    'providers' => array(

    // ...

    'Thepsion5\Menuizer\Support\Laravel\MenuizerServiceProvider',

    );
```

Next, add the Menuizer facade to the array of aliases in the same file:

```
    'aliases' => array(

        // ...

        'Menuizer' => 'Thepsion5\Menuizer\Support\Laravel\Facade'
    );
```

You may now access any of the Menuizer service's functions via the facade:

```
Menuizer::render('foo');
```

Basic Usage
-----------

[](#basic-usage)

\###Creating Menus Menu attributes and behavior is defined using arrays of strings with a simple, easy-to-read syntax:

```
$menuizer->define('primary', array(
    'url:/|label:Home',
    'url:/news|label:News|attributes:class=highlight,id=news',
    'url:/about|label:About Us',
    'url:/staff|label:Our Team',
    'url:/projects|label:Major Projects'
));
```

The `define()` function accepts a menu name as the first argument and an array of attributes as the second argument.

To render the defined menu, use the `render()` method:

```
