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

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

forci/menu-builder-bundle
=========================

A simple, standalone Menu Builder for Symfony 2 Applications

v0.5.1(6y ago)06.0k↓93.3%2MITPHPPHP &gt;=7.1.3CI failing

Since Jan 27Pushed 6y ago2 watchersCompare

[ Source](https://github.com/forci/menu-builder-bundle)[ Packagist](https://packagist.org/packages/forci/menu-builder-bundle)[ RSS](/packages/forci-menu-builder-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (6)Versions (26)Used By (2)

menu-builder-bundle
===================

[](#menu-builder-bundle)

A simple, standalone Menu Builder for Symfony 2 Applications

Upcoming / TODO
---------------

[](#upcoming--todo)

- TODO: Introduce cache.

Minor TODO
----------

[](#minor-todo)

- Put docs inside of this bundle, this is the Core and is for developers only. The Client one is meant to be your base client, if that does not satisfy you, build your own with your own user experience
- TODO: Static config with system routes - upon import, always make all of these system

Usage
-----

[](#usage)

Having properly configured uglifycss and uglifyjs is a requirement for production.

Add this bundle to your AppKernel.php `new \Forci\Bundle\MenuBuilder\ForciMenuBuilderBundle()`Add wucdbm's QuickUIBundle to your AppKernel.php `new \Wucdbm\Bundle\QuickUIBundle\WucdbmQuickUIBundle()`

Execute `app/console doctrine:schema:update --dump-sql` and after verifying what is being executed, execute again with --force. Alternatively, use doctrine migrations via the DoctrineMigrations bundle.

Execute `app/console forci_menu_builder:import_routes` to import your current routes from your symfony application into the tables created by the bundle.

Once this has been done, you can start using the bundle. Simply register it in your routing.yml like so:

```
wucdbm_builder:
    resource: "@ForciMenuBuilderBundle/Resources/config/routing.yml"
    prefix: /admin/builder

```

Assuming that /admin is protected by a firewall, the builder should be secure and inaccessible to random people.

You can create a link to the builder using `{{ path('forci_menu_builder_dashboard') }}`, or embed it into your admin UI via an iframe like so ``

The User Interface is pretty anemic as this bundle only implements the core functionality and the administrative (for developers) functionality. If you want to let users (non-developers) manipulate menus, check out the `ForciMenuBuilderClientBundle()`Once you have created a menu, you can access it in your application by calling the `getMenu`twig function, which will return `Forci\Bundle\MenuBuilder\Entity\Menu` or `null`. A menu contains `Forci\Bundle\MenuBuilder\Entity\MenuItem`s. Menu items can be nested, ie they have a parent and children. A good idea when listing the top-level menu is to only list items whose parent is null:

```
{# New: You can use the menuTopLevelItems filter to get all top-level items: #}
{% for item in getMenu(1)|menuTopLevelItems %}

```

```
{% if getMenu(1) %} {# You could also use any constant with the constant() function or any other way of referencing the menu ID #}
    {% for item in getMenu(1).items if item.parent is null %}
        {# You can recursively include your templates to list the sub-menus #}
        {% include '@Some/location/template.html.twig' with {items: item.children} %}
    {% endfor %}
{% endif %}

```

```
{% if getMenu(1) %}
    {% for item in getMenu(1).items if item.parent is null %}

                {{ item.name }}

    {% endfor %}
{% endif %}

```

Printing a link for a menu is done via the `menuItemPath` twig filter/function, like so:

```

    {{ item.name }}

```

Or for absolute links

```

    {{ item.name }}

```

You can also use the second (optional) parameter for `menuItemUrl` and set the type of address (one of the `Symfony\Component\Routing\Generator\UrlGeneratorInterface` constants)

Dynamic Default Parameters
--------------------------

[](#dynamic-default-parameters)

If you want to have a dynamic default parameter for some of your routes, for instance, routes with a dynamic locale:

In config.yml:

```
framework:
    default_locale:  en

```

In routing.yml:

```
some_resource:
    resource: "@SomeBundle/Resources/config/routing.yml"
    prefix: /{_locale}
    schemes:  [https]
    requirements:
        _locale: "en|de|ru"
    defaults:
        _locale: %kernel.default_locale%

```

Generally, you do NOT need the `defaults: {_locale: %kernel.default_locale%}` part because you already have the default locale configured in your framework bundle config, but this will only work for `_locale`However, with this approach the default value for the `_locale` route parameter will be available to the menu builder when importing routes. When building a link, you may choose to leave the field blank if there is a default parameter. This will allow you to change the default value for that parameter at a later point, WITHOUT having to update menu items. When routes are updated during the deployment of your application, the default value for that parameter of your route will also be updated. The current value of the default parameter will always be saved upon menu item edit anyway, but the menu builder will always try to use the current default value for that route parameter. If the default value for any parameter has been removed, it will fallback to the route default parameter as has been on the last menu item save.

Not to be confused with symfony internal parameters such as `_locale` that may have another default value in the current context
--------------------------------------------------------------------------------------------------------------------------------

[](#not-to-be-confused-with-symfony-internal-parameters-such-as-_locale-that-may-have-another-default-value-in-the-current-context)

An example would be a site with default locale of "en", but the user is browsing the "fr" version. You want your links to always point to the current locale and not to a pre-selected one or the default for your site. Which is a feature that has not yet been developed, but this would allow you to completely ignore a parameter and not provide it if it already exists in the router context? To be researched. See TODOs for more information on this.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity58

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

Recently: every ~2 days

Total

25

Last Release

2357d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/56129a0e9c0044d2857f405e0cf44b1c8f53bc86503dfc1c0ac3829401333c5e?d=identicon)[wucdbm](/maintainers/wucdbm)

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

---

Top Contributors

[![wucdbm](https://avatars.githubusercontent.com/u/1559022?v=4)](https://github.com/wucdbm "wucdbm (32 commits)")

---

Tags

Symfony2buildermenumenu-builderwucdbm

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M386](/packages/easycorp-easyadmin-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[metamodels/core

MetaModels core

10156.4k66](/packages/metamodels-core)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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