PHPackages                             torifat/cake-menu\_builder - 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. torifat/cake-menu\_builder

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

torifat/cake-menu\_builder
==========================

A dynamic menu building helper for CakePHP 2.x

v2.0.3(11y ago)755.6k34[1 PRs](https://github.com/torifat/cake-menu_builder/pulls)MITPHPPHP &gt;=5.3.0

Since Feb 18Pushed 11y ago12 watchersCompare

[ Source](https://github.com/torifat/cake-menu_builder)[ Packagist](https://packagist.org/packages/torifat/cake-menu_builder)[ Docs](https://github.com/torifat/cake-menu_builder)[ RSS](/packages/torifat-cake-menu-builder/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (1)Versions (5)Used By (0)

[![Build Status](https://camo.githubusercontent.com/dd4c34173fe22d2a72948ffb0dd46677d5bc15896d6c0b16bec9c8aa313914cb/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f746f72696661742f63616b652d6d656e755f6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/torifat/cake-menu_builder) [![Coverage Status](https://camo.githubusercontent.com/3e10a2485713a7dd2cc02777726c5c3dde0438a911ecc6b9bb9a97c21911570b/687474703a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f746f72696661742f63616b652d6d656e755f6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/torifat/cake-menu_builder?branch=master) [![Total Downloads](https://camo.githubusercontent.com/9c8cbb755de79941d1d31d00f3f552d0c2dc2e9a3d29e4c95bd497657a42f13b/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f72696661742f63616b652d6d656e755f6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/torifat/cake-menu_builder) [![Latest Stable Version](https://camo.githubusercontent.com/434553ab98659c4eaaaef3ea1ad0d3d5f865da5a5184c611e0a45907adb4acc0/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f72696661742f63616b652d6d656e755f6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/torifat/cake-menu_builder)

MenuBuilder Helper
==================

[](#menubuilder-helper)

A dynamic menu building helper for CakePHP

Background
----------

[](#background)

This is a menu building helper with lot of customization options. Check out the **Usage** section.

Now it supports menus built with [ACL Menu Component](http://mark-story.com/posts/view/acl-menu-component) by [Mark Story](http://mark-story.com/)

Features
--------

[](#features)

- Generate menu based on current user type/group/permission/level (Can be used with Auth, Authsome, etc Components)
- Provide various useful CSS class
- Multi-level menu support
- Supports [ACL Menu Component](http://mark-story.com/posts/view/acl-menu-component) by [Mark Story](http://mark-story.com/)
- CakePHP Unit Test (100% Code coverage)

Requirements
------------

[](#requirements)

- CakePHP 2.x
- PHP 5.3

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

[](#installation)

*\[Using [Composer](http://getcomposer.org/)\]*

Add the plugin to your project's `composer.json` - something like this:

```
  {
    "require": {
      "torifat/cake-menu_builder": "2.0.3"
    }
  }

```

Because this plugin has the type `cakephp-plugin` set in its own `composer.json`, Composer will install it inside your `/Plugins` directory, rather than in the usual vendors file. It is recommended that you add `/Plugins/MenuBuilder` to your .gitignore file. (Why? [read this](http://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md).)

*\[Manual\]*

- Download this: [http://github.com/torifat/cake-menu\_builder/zipball/master](http://github.com/torifat/cake-menu_builder/zipball/master)
- Unzip that download.
- Copy the resulting folder to `app/Plugin`
- Rename the folder you just copied to `MenuBuilder`

*\[GIT Submodule\]*

In your app directory type:

```
  git submodule add -b master git://github.com/torifat/cake-menu_builder.git Plugin/MenuBuilder
  git submodule init
  git submodule update
```

*\[GIT Clone\]*

In your `Plugin` directory type:

```
git clone -b master git://github.com/torifat/cake-menu_builder.git MenuBuilder

```

### Enable plugin

[](#enable-plugin)

In 2.0 you need to enable the plugin in your `app/Config/bootstrap.php` file:

```
CakePlugin::load('MenuBuilder');

```

If you are already using `CakePlugin::loadAll();`, then this is not necessary.

Usage
=====

[](#usage)

Minimal Setup
-------------

[](#minimal-setup)

Load the Plugin by modifying your app/Config/bootstrap.php

```

```

or

```

```

To use this helper add the following to your AppController:

```

```

Now to build your `main-menu` use the following code in the View:

```

```

You'll get the following output in the Home (/pages/home) page:

```

    Home
    About Us

```

And to build your `left-menu` use the following code in the View:

```

```

You'll get the following output in your 'Item 4' (/items/view/4) page:

```

        Item 1

                Item 3

                Item 4

        Item 2

```

You can pass optional parameter in `build` function like -

```
