PHPackages                             becklyn/page-tree-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. becklyn/page-tree-bundle

Abandoned → [becklyn/route-tree-bundle](/?search=becklyn%2Froute-tree-bundle)Symfony-bundle[Utility &amp; Helpers](/categories/utility)

becklyn/page-tree-bundle
========================

This bundle provides a simple implementation of a tree built from routing configuration.

4.2.1(3y ago)37194BSD-3-ClausePHPPHP &gt;=7.2

Since Nov 12Pushed 3y ago3 watchersCompare

[ Source](https://github.com/Becklyn/RouteTreeBundle)[ Packagist](https://packagist.org/packages/becklyn/page-tree-bundle)[ Docs](https://github.com/Becklyn/BecklynRouteTreeBundle)[ RSS](/packages/becklyn-page-tree-bundle/feed)WikiDiscussions 2.x Synced 3d ago

READMEChangelog (10)Dependencies (9)Versions (36)Used By (0)

BecklynRouteTreeBundle
======================

[](#becklynroutetreebundle)

Adds a simple implementation for an automatic generation of a route tree to build a menu.

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

[](#installation)

Install the bundle via [packagist](https://packagist.org/packages/becklyn/route-tree-bundle):

```
    // ...
    require: {
        // ...
        "becklyn/route-tree-bundle": "^2.0"
    },
    // ...
```

Load the bundle in your `app/AppKernel.php`:

```
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new \Becklyn\RouteTreeBundle\BecklynRouteTreeBundle(),
        );
        // ...
    }
```

Defining The Route Tree Nodes
-----------------------------

[](#defining-the-route-tree-nodes)

You add elements to the tree by setting the options of the routes:

```
homepage:
    path: /

my_route:
    path: /my_route
    options:
        tree:
            parent: homepage
            title:  "My Route"
```

Path Options
------------

[](#path-options)

```
route:
    # ...
    options:
        tree:
            parent:     homepage       # the name of the parent node
            priority:   0              # (optional) the
            title:      "abc"          # (optional) title of the node
            parameters: {}             # (optional) the default values for the parameters
            security:   ~              # (optional) the security expression
```

`parent` must be set. Also all referenced `parent`-routes need to exist.

### Priority

[](#priority)

All child nodes of all nodes are sorted by descending priority.

### Hidden

[](#hidden)

All items are automatically hidden, if they have no title set (or if the security expression evaluates to false).

### Parameters

[](#parameters)

The parameters can define default values for parameters:

```
page_listing:
    path: /listing/{page}
    options:
        tree:
            parameters:
                page: 1
```

**If you do not define a value, the parameter is looked up in the request attributes of the current request. If it doesn't find anything there, `1` is used.**

### Security

[](#security)

Every node can have a custom security expression, that is evaluated when printing the tree. All nodes where the security expression evaluates to `false` are automatically hidden (including all their child nodes).

If no explicit security expression is given, the builder tries to infer the expression from the linked controller by combining `@IsGranted()`and `@Security()` annotations from the action method and the controller class. If `@IsGranted()` is used with the `subject` attribute, nothing is infered.

### Extra Parameters

[](#extra-parameters)

You can define additional parameters, that can be used in the menu template. All path options that are not recognized (see "Path Options") are automatically added as extra parameters.

```
route:
    options:
        tree:
            parent: homepage
            title: Pages
            icon: pages
```

These extra parameters are available in the template under the `extra` property:

```
{{ item.extra("icon") }}
```

### Error Cases

[](#error-cases)

If the page tree is invalid a `InvalidRouteTreeException` is thrown, on the first construction of the page tree.

Short Syntax
------------

[](#short-syntax)

In simple cases, the config can be simplified to:

```
route:
    options:
        tree: "parent"

# ... means the same as ...

route:
    options:
        tree:
            parent: "parent"
```

Rendering the Route Tree
------------------------

[](#rendering-the-route-tree)

There is an automatic menu builder, that you can just use in the templates:

```
{{- route_tree_render("my_route", {...}) -}}
```

The first parameter is the parent node of which the menu should be used. The second (optional) argument are the [KnpMenu render options](https://github.com/KnpLabs/KnpMenu/blob/master/doc/01-Basic-Menus.markdown#other-rendering-options).

Getting The Route Tree
----------------------

[](#getting-the-route-tree)

You can inject the service `Becklyn\RouteTreeBundle\Tree\RouteTree` and use it to retrieve a node:

```
    // get a node with a specific route. With this node you can traverse the route tree.
    $treeUnderMyRoute = $routeTree->getNode("my_route");
```

The return value is a `Becklyn\RouteTreeBundle\Node\Node`.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 72.2% 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 ~98 days

Recently: every ~269 days

Total

35

Last Release

1218d ago

Major Versions

v1.5.1 → 2.0.02016-06-28

2.0.2 → 3.0.0-beta.12017-12-19

3.2.2 → 4.0.02019-07-10

2.x-dev → 4.2.02022-02-17

PHP version history (6 changes)v1.0.3PHP &gt;=5.4.0

2.0.0PHP ^5.6|^7.0

3.0.0-beta.1PHP ^7.1

4.0.0PHP ^7.2

4.2.0PHP &gt;=7.4

4.2.1PHP &gt;=7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1044355?v=4)[Becklyn Studios](/maintainers/becklyn)[@Becklyn](https://github.com/Becklyn)

![](https://www.gravatar.com/avatar/978a2e9c861659e539e4f097514214657483a542d01ddb72e1cdf0ef6bc7a2c6?d=identicon)[apfelbox](/maintainers/apfelbox)

![](https://www.gravatar.com/avatar/653e3e61f49a77663a3ae00388c79423763180e19e4eba9d8cfe0b9c68be1443?d=identicon)[tk](/maintainers/tk)

---

Top Contributors

[![apfelbox](https://avatars.githubusercontent.com/u/1032411?v=4)](https://github.com/apfelbox "apfelbox (26 commits)")[![lukasbrodbeck](https://avatars.githubusercontent.com/u/12810590?v=4)](https://github.com/lukasbrodbeck "lukasbrodbeck (4 commits)")[![Gemineye](https://avatars.githubusercontent.com/u/647292?v=4)](https://github.com/Gemineye "Gemineye (3 commits)")[![keichinger](https://avatars.githubusercontent.com/u/439899?v=4)](https://github.com/keichinger "keichinger (2 commits)")[![tkasper](https://avatars.githubusercontent.com/u/1580938?v=4)](https://github.com/tkasper "tkasper (1 commits)")

---

Tags

phpsymfonysymfony-bundle

### Embed Badge

![Health badge](/badges/becklyn-page-tree-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/becklyn-page-tree-bundle/health.svg)](https://phpackages.com/packages/becklyn-page-tree-bundle)
```

###  Alternatives

[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

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

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

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/storefront

Storefront for Shopware

684.2M148](/packages/shopware-storefront)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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