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

ActiveSymfony-bundle

fgc/menu-bundle
===============

A simple yet robust menu generator for Symfony4

v3.0.1(7y ago)0131MITPHP

Since Jan 21Pushed 6y ago1 watchersCompare

[ Source](https://github.com/fatguytyson/menu-bundle)[ Packagist](https://packagist.org/packages/fgc/menu-bundle)[ RSS](/packages/fgc-menu-bundle/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (1)Dependencies (3)Versions (19)Used By (0)

FGCMenuBundle
=============

[](#fgcmenubundle)

The FGCMenuBundle is a simple yet robust menu renderer for Symfony4.

The biggest change is the decision to remove Annotation Support. The feature made code handling difficult to manage, and chasing down menu items difficult. So centralising menu creation in configurations, and events.

Documentation
-------------

[](#documentation)

### Installation

[](#installation)

#### 1. Download the bundle

[](#1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require fgc/menu-bundle
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md) of the Composer documentation.

#### 2. Enable the Bundle

[](#2-enable-the-bundle)

Then, enable the bundle by adding the following line in the `app/AppKernel.php` file of your project:

This is only needed if you don't have symfony/flex.

```
// config/bundles.php

// ...
return [
            // ...
            FGC\MenuBundle\FGCMenuBundle::class => ['all' => true],
        ];
```

#### 3. Configure the bundle

[](#3-configure-the-bundle)

The bundle comes with a sensible default configuration, which is listed below. You can define these options if you need to change them:

```
# config/packages/fgc_menu.yaml
fgc_menu:
    # Menu group name and identifier
    # default is also the group given if omitted
    default:
        # Menu Title
        Home Page:
            # each option below is optional
            # route name for the link to generate
            route: homepage
            # route parameters if any. If omitted, an empty array is returned
            routeOptions:
                option: value
                option2: value
            # icon to be attached to the menu item. Great for dashboards
            icon: dashboard
            # order of the items, so inserted Items during events can be integrated smoothly
            order: 1
            # a single ROLE to show only if is_granted() or none to always show This was previously ROLE, and is a
            # breaking change.
            granted: IS_ANONYMOUS
            # This is needed if the granted action needs an object to check against. You may need to dynamically add
            # the menu item to add objects rather than strings
            grantedObject: 'User'
            # to make mult-level menus, menu name to place under this item.
            children: user
```

### Add Dynamic Menu Items

[](#add-dynamic-menu-items)

Follow the [instructions](https://symfony.com/doc/current/components/event_dispatcher.html#using-event-subscribers) to make an event subscriber and listen for the `DiscoverMenuEvent::NAME` event.

Here, you can `$event->addMenuItem(Menu)` on the fly.

Make sure to remember to add group names.

And lastly:

### Render the menus in your templates.

[](#render-the-menus-in-your-templates)

```
{# ... #}
{{ fgc_menu() }}
{# ... #}
```

This renders:

```

        Home

        Admin Area

```

And can be modified with additional parameters.

```
{{ fgc_menu("Menu Group Name", "template name", (int)depth) }}
```

### Templating the menu

[](#templating-the-menu)

I have a few templates I have needed already.

- default
- bootstrap4
- sb\_admin\_2

There are more coming, and can easily be overridden by adding them to your app/Resources directory.

```
{# templates/bundles/FGCMenuBundle/{template_name}.html.twig #}
{% for item in menu %}
    {% if not item.granted or is_granted(item.granted, item.grantedObject) %}

                {% if item.icon %}{% endif %}
                {{ item.name }}

            {% if item.children and depth %}

                    {{ fgc_menu(item.children, template, depth) }}

            {% endif %}

    {% endif %}
{% endfor %}
```

Afterword
---------

[](#afterword)

In v2, cache was attempted to be added, and while it saved the cache correctly, there are too many variables to chase down into to generate the cache key. I may try again, but not now.

Please feel free to submit issues so it can be improved.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity72

Established project with proven stability

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

Recently: every ~2 days

Total

18

Last Release

2727d ago

Major Versions

v0.9 → v1.02018-01-25

v1.4.2 → v2.02018-11-20

v2.0.4 → v3.0.02018-11-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f0dea862f8788e227d1aa27066ebd9288a092cfe6f35a5da4b5a7b6268c1c10?d=identicon)[fatguytyson](/maintainers/fatguytyson)

---

Top Contributors

[![fatguytyson](https://avatars.githubusercontent.com/u/14961127?v=4)](https://github.com/fatguytyson "fatguytyson (35 commits)")

---

Tags

symfonySimplemenu

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[webfactory/icu-translation-bundle

Enables ICU message formatting for translations in Symfony applications.

2761.8k](/packages/webfactory-icu-translation-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1714.8k8](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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