PHPackages                             id4v/menu-bundle - 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. id4v/menu-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

id4v/menu-bundle
================

Menu Bundle that allows you to create menus, and manage them easily with SonataAdminBundle

2.0.4(10y ago)22.0k2[3 issues](https://github.com/Id4v/MenuBundle/issues)1MITPHP

Since Mar 20Pushed 9y ago2 watchersCompare

[ Source](https://github.com/Id4v/MenuBundle)[ Packagist](https://packagist.org/packages/id4v/menu-bundle)[ RSS](/packages/id4v-menu-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (11)Used By (1)

[![SensioLabsInsight](https://camo.githubusercontent.com/e00a79332e74629d062a813ac0f9e1b71194e326f01214f6bf96c02bdf7b699b/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f64393564386662372d643632302d346332302d613436632d3562623839636462326130312f736d616c6c2e706e67)](https://insight.sensiolabs.com/projects/d95d8fb7-d620-4c20-a46c-5bb89cdb2a01)

MenuBundle
==========

[](#menubundle)

Id4vMenuBundle is a Symfony2 bundle to manage menus easily

How it works
------------

[](#how-it-works)

A Menu is a tree of MenuItems

MenuItems are

- A label to display
    - Optionally an icon to show
- A link to go when clicked

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

[](#installation)

1 Install it using composer

```
composer require id4v/menu-bundle
```

2 Activate the bundle in your `AppKernel.php` file

```
public function registerBundles()
    {
        $bundles = array(
        ...
        # if you haven't already this bundle
        new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
        ...
        new \Id4v\Bundle\MenuBundle\Id4vMenuBundle(),
        ...
        );
        return $bundles
    }
```

3 Add this mandatory configuration for the `StofDoctrineExtensionsBundle` in your `config.yml`

```
stof_doctrine_extensions:
    orm:
        default:
            sluggable: true
```

4 Register the `id4v_menu.admin.menu` Service to your sonata admin configuration

5 Profit!

Usage
-----

[](#usage)

\####Create your menu in the admin of your website.

\####Organize your menu by adding MenuItems, drag and dropping them

\####Render your Menu in twig templates

\####Full exemple of implementation

```
{{ knp_menu_render("app.menu.main", {template: "Id4vMenuBundle:Menu:main.html.twig"}) }}
```

or

```
{{ knp_menu_render("app.menu.main", {template: "menu:main.html.twig"}) }}
```

All documentation for this tag is available here : [KnpMenuBundle](http://symfony.com/doc/master/bundles/KnpMenuBundle/index.html).

A base builder as been added to help common usage of menu creation, the `BaseMenuBuilder.php` class.

First of all the basic declaration of your builder can be :

```
namespace AppBundle\Menu;

use Knp\Menu\FactoryInterface;
use Doctrine\ORM\EntityManager;
use Id4v\Bundle\MenuBundle\Builder\BaseMenuBuilder;

class AppMenuBuilder extends BaseMenuBuilder
{
    public function __construct(FactoryInterface $factory, EntityManager $em)
    {
        parent::__construct($factory, $em);
    }

    public function createMainMenu()
    {
        return $this->getSimpleMenu('main-menu');
    }
}
```

You can now declare yours services :

```
services:
    app.menu_builder:
        class: AppBundle\Menu\AppMenuBuilder
        arguments: ["@knp_menu.factory", "@doctrine.orm.entity_manager"]

    app.menu.main:
        class: Knp\Menu\MenuItem # the service definition requires setting the class
        factory: ["@app.menu_builder", createMainMenu]
        arguments: ["@request_stack"]
        tags:
            - { name: knp_menu.menu, alias: app.menu.main }
```

You can consult documentation of this declaration in [KnpMenuBundle Doc](http://symfony.com/doc/master/bundles/KnpMenuBundle/index.html).

Moreover you can activate an URI matcher or adapt one on your need.

```
services:
    app.voter.regex:
        class: Id4v\Bundle\MenuBundle\Matcher\Voter\UriVoter
        arguments: ["@request_stack"]
        tags:
            - { name: knp_menu.voter }
```

Sonata Admin
------------

[](#sonata-admin)

Sometimes you get an abundant tree into your menus. And the performance of the administration get found affected. It's the reason why existing a configuration with the bundle.

By default you can only drap and drop two levels depth. If you want to change it, modify the `menu_depth` node.

**Default Configuration**

```
id4v_menu:
    admin:
        menu_depth: 2
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 56.9% 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 ~24 days

Total

9

Last Release

3884d ago

Major Versions

1.1.2 → 2.0.02015-07-03

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/231784?v=4)[Damien Letournel](/maintainers/moustik)[@moustik](https://github.com/moustik)

---

Top Contributors

[![Th3Mouk](https://avatars.githubusercontent.com/u/5006899?v=4)](https://github.com/Th3Mouk "Th3Mouk (58 commits)")[![Id4v](https://avatars.githubusercontent.com/u/4057774?v=4)](https://github.com/Id4v "Id4v (44 commits)")

---

Tags

menuMenu generator

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[knplabs/knp-menu

An object oriented menu library

1.4k55.8M287](/packages/knplabs-knp-menu)[knplabs/knp-menu-bundle

This bundle provides an integration of the KnpMenu library

1.4k53.8M315](/packages/knplabs-knp-menu-bundle)

PHPackages © 2026

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