PHPackages                             mhujer/breadcrumbs-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. mhujer/breadcrumbs-bundle

Abandoned → [Huluti/BreadcrumbsBundle](/?search=Huluti%2FBreadcrumbsBundle)ArchivedSymfony-bundle[Utility &amp; Helpers](/categories/utility)

mhujer/breadcrumbs-bundle
=========================

Breadcrumbs bundle for Symfony

1.5.10(1y ago)701.8M↓14%12[5 issues](https://github.com/mhujer/BreadcrumbsBundle/issues)4MITPHPPHP ^8.1CI failing

Since Aug 27Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/mhujer/BreadcrumbsBundle)[ Packagist](https://packagist.org/packages/mhujer/breadcrumbs-bundle)[ Docs](https://github.com/mhujer/BreadcrumbsBundle)[ RSS](/packages/mhujer-breadcrumbs-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (12)Used By (4)

**Note:** This package is no longer maintained, see [discussion in issue #44](https://github.com/mhujer/BreadcrumbsBundle/issues/44). You can use [Huluti/BreadcrumbsBundle](https://github.com/Huluti/BreadcrumbsBundle) which supports Symfony 8.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#note-this-package-is-no-longer-maintained-see-discussion-in-issue-44-you-can-use-hulutibreadcrumbsbundle-which-supports-symfony-8)

---

*This is a fork of [whiteoctober/BreadcrumbsBundle](https://github.com/whiteoctober/BreadcrumbsBundle) maintained for newer Symfony versions. See [whiteoctober/BreadcrumbsBundle#106](https://github.com/whiteoctober/BreadcrumbsBundle/issues/106).*

Installation
============

[](#installation)

1. Install this bundle using [Composer](https://getcomposer.org/):

    ```
    composer require mhujer/breadcrumbs-bundle
    ```

If you're using Symfony Flex, the following steps will be done automatically.

2. Enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    WhiteOctober\BreadcrumbsBundle\WhiteOctoberBreadcrumbsBundle::class => ['all' => true],
];
```

3. Configure the bundle in `config/packages/white_october_breadcrumbs.yaml`:

    ```
    # config/packages/white_october_breadcrumbs.yaml
    white_october_breadcrumbs: ~
    ```

That's it for basic configuration. For more options check the [Configuration](#configuration) section.

Usage
=====

[](#usage)

In your application controller methods:

```
public function yourAction(User $user)
{
    $breadcrumbs = $this->get("white_october_breadcrumbs");

    // Simple example
    $breadcrumbs->addItem("Home", $this->get("router")->generate("index"));

    // Example without URL
    $breadcrumbs->addItem("Some text without link");

    // Example with parameter injected into translation "user.profile"
    $breadcrumbs->addItem($txt, $url, ["%user%" => $user->getName()]);
}
```

It is preferable, that you don't retrieve the service via `get`. Use [dependency injection](https://symfony.com/doc/current/service_container.html#fetching-and-using-services) instead:

```
use WhiteOctober\BreadcrumbsBundle\Model\Breadcrumbs;

class YourController extends AbstractController
{
    public function yourAction(Breadcrumbs $breadcrumbs)
    {
      // ...
    }
}
```

Then, in your template:

```
{{ wo_render_breadcrumbs() }}
```

The last item in the breadcrumbs collection will automatically be rendered as plain text rather than a `...` tag.

The `addItem()` method adds an item to the *end* of the breadcrumbs collection. You can use the `prependItem()` method to add an item to the *beginning* of the breadcrumbs collection. This is handy when used in conjunction with hierarchical data (e.g. Doctrine Nested-Set). This example uses categories in a product catalog:

```
public function yourAction(Category $category)
{
    $breadcrumbs = $this->get("white_october_breadcrumbs");

    $node = $category;

    while ($node) {
        $breadcrumbs->prependItem($node->getName(), "");

        $node = $node->getParent();
    }
}
```

If you do not want to generate a URL manually, you can easily add breadcrumb items passing only the route name with any required parameters, using the `addRouteItem()`and `prependRouteItem()` methods:

```
public function yourAction()
{
    $breadcrumbs = $this->get("white_october_breadcrumbs");

    // Pass "_demo" route name without any parameters
    $breadcrumbs->addRouteItem("Demo", "_demo");

    // Pass "_demo_hello" route name with route parameters
    $breadcrumbs->addRouteItem("Hello Breadcrumbs", "_demo_hello", [
        'name' => 'Breadcrumbs',
    ]);

    // Add "homepage" route link at the start of the breadcrumbs
    $breadcrumbs->prependRouteItem("Home", "homepage");
}
```

Configuration
=============

[](#configuration)

The following *default* parameters can be overridden in your `config/packages/white_october_breadcrumbs.yaml`:

```
# config/packages/white_october_breadcrumbs.yaml
white_october_breadcrumbs:
    separator:          '/'
    separatorClass:     'separator'
    listId:             'wo-breadcrumbs'
    listClass:          'breadcrumb'
    itemClass:          ''
    linkRel:            ''
    locale:             ~ # defaults to null, so the default locale is used
    translation_domain: ~ # defaults to null, so the default domain is used
    viewTemplate:       '@WhiteOctoberBreadcrumbs/microdata.html.twig'
```

These can also be passed as parameters in the view when rendering the breadcrumbs - for example:

```
{{ wo_render_breadcrumbs({separator: '>', listId: 'breadcrumbs'}) }}
```

> **NOTE:** If you need more than one set of breadcrumbs on the same page you can use namespaces. By default, breadcrumbs use the `default` namespace, but you can add more. To add breadcrumbs to your custom namespace use `addNamespaceItem` / `prependNamespaceItem`or `addNamespaceRouteItem` / `prependNamespaceRouteItem` methods respectively, for example:

```
public function yourAction(User $user)
{
    $breadcrumbs = $this->get("white_october_breadcrumbs");

    // Simple example
    $breadcrumbs->prependNamespaceItem("subsection", "Home", $this->get("router")->generate("index"));

    // Example without URL
    $breadcrumbs->addNamespaceItem("subsection", "Some text without link");

    // Example with parameter injected into translation "user.profile"
    $breadcrumbs->addNamespaceItem("subsection", $txt, $url, ["%user%" => $user->getName()]);

    // Example with route name with required parameters
    $breadcrumbs->addNamespaceRouteItem("subsection", $user->getName(), "user_show", ["id" => $user->getId()]);
}
```

Then to render the `subsection` breadcrumbs in your templates, specify this namespace in the options:

```
{{ wo_render_breadcrumbs({namespace: "subsection"}) }}
```

Advanced Usage
==============

[](#advanced-usage)

You can add a whole array of objects at once

```
$breadcrumbs->addObjectArray(array $objects, $text, $url, $translationParameters);
```

```
objects:            array of objects
text:               name of object property or closure
url:                name of URL property or closure

```

Example:

```
$that = $this;
$breadcrumbs->addObjectArray($selectedPath, "name", function($object) use ($that) {
    return $that->generateUrl('_object_index', ['slug' => $object->getSlug()]);
});
```

You can also add a tree path

```
$breadcrumbs->addObjectTree($object, $text, $url = "", $parent = 'parent', array $translationParameters = [], $firstPosition = -1)
```

```
object:             object to start with
text:               name of object property or closure
url:                name of URL property or closure
parent:             name of parent property or closure
firstPosition:      position to start inserting items (-1 = determine automatically)

```

> **NOTE:** You can use `addNamespaceObjectArray` and `addNamespaceObjectTree` respectively for work with multiple breadcrumbs on the same page.

Overriding the template
=======================

[](#overriding-the-template)

There are two methods for doing this.

1. You can override the template used by copying the `Resources/views/microdata.html.twig` file out of the bundle and placing it into `/templates/bundles/WhiteOctoberBreadcrumbsBundle`, then customising as you see fit. Check the [Overriding bundle templates](https://symfony.com/doc/current/bundles/override.html#templates) documentation section for more information.
2. Use the `viewTemplate` configuration parameter:

    ```
    {{ wo_render_breadcrumbs({ viewTemplate: "@WhiteOctoberBreadcrumbs/yourBreadcrumbs.html.twig" }) }}
    ```

> **NOTE:** If you want to use the JSON-LD format, there's already an existing template at `@WhiteOctoberBreadcrumbs/json-ld.html.twig`. Just set this template as the value for `viewTemplate` either in your Twig function call (see Step 2 above) or in your bundle [configuration](#configuration).

Contributing
============

[](#contributing)

We welcome contributions to this project, including pull requests and issues (and discussions on existing issues).

If you'd like to contribute code but aren't sure what, the [issues list](https://github.com/mhujer/breadcrumbsbundle/issues) is a good place to start. If you're a first-time code contributor, you may find Github's guide to [forking projects](https://guides.github.com/activities/forking/) helpful.

All contributors (whether contributing code, involved in issue discussions, or involved in any other way) must abide by our [code of conduct](https://github.com/whiteoctober/open-source-code-of-conduct/blob/master/code_of_conduct.md).

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance59

Moderate activity, may be stable

Popularity54

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~255 days

Total

11

Last Release

609d ago

PHP version history (4 changes)1.5.0PHP ~7.2

1.5.3PHP ~7.3|~8.0

1.5.4PHP ~7.4|~8.0

1.5.9PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![richsage](https://avatars.githubusercontent.com/u/231551?v=4)](https://github.com/richsage "richsage (60 commits)")[![mhujer](https://avatars.githubusercontent.com/u/353372?v=4)](https://github.com/mhujer "mhujer (60 commits)")[![balazslevi](https://avatars.githubusercontent.com/u/12248065?v=4)](https://github.com/balazslevi "balazslevi (16 commits)")[![bocharsky-bw](https://avatars.githubusercontent.com/u/3317635?v=4)](https://github.com/bocharsky-bw "bocharsky-bw (16 commits)")[![toooni](https://avatars.githubusercontent.com/u/241080?v=4)](https://github.com/toooni "toooni (5 commits)")[![andrewmy](https://avatars.githubusercontent.com/u/715595?v=4)](https://github.com/andrewmy "andrewmy (3 commits)")[![basdenooijer](https://avatars.githubusercontent.com/u/580644?v=4)](https://github.com/basdenooijer "basdenooijer (3 commits)")[![micotodev](https://avatars.githubusercontent.com/u/1260246?v=4)](https://github.com/micotodev "micotodev (2 commits)")[![quentin-st](https://avatars.githubusercontent.com/u/1551971?v=4)](https://github.com/quentin-st "quentin-st (2 commits)")[![dxops](https://avatars.githubusercontent.com/u/1804871?v=4)](https://github.com/dxops "dxops (2 commits)")[![sampart](https://avatars.githubusercontent.com/u/1507328?v=4)](https://github.com/sampart "sampart (2 commits)")[![Simounet](https://avatars.githubusercontent.com/u/582666?v=4)](https://github.com/Simounet "Simounet (2 commits)")[![maxhelias](https://avatars.githubusercontent.com/u/12966574?v=4)](https://github.com/maxhelias "maxhelias (2 commits)")[![andreybolonin](https://avatars.githubusercontent.com/u/2576509?v=4)](https://github.com/andreybolonin "andreybolonin (2 commits)")[![COil](https://avatars.githubusercontent.com/u/177844?v=4)](https://github.com/COil "COil (2 commits)")[![cached](https://avatars.githubusercontent.com/u/202738?v=4)](https://github.com/cached "cached (1 commits)")[![soullivaneuh](https://avatars.githubusercontent.com/u/1698357?v=4)](https://github.com/soullivaneuh "soullivaneuh (1 commits)")[![Daamian](https://avatars.githubusercontent.com/u/6651750?v=4)](https://github.com/Daamian "Daamian (1 commits)")[![wickedOne](https://avatars.githubusercontent.com/u/343850?v=4)](https://github.com/wickedOne "wickedOne (1 commits)")[![imctomhv](https://avatars.githubusercontent.com/u/24391197?v=4)](https://github.com/imctomhv "imctomhv (1 commits)")

---

Tags

symfonybreadcrumbs

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mhujer-breadcrumbs-bundle/health.svg)

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

###  Alternatives

[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[pentatrion/vite-bundle

Vite integration for your Symfony app

2755.3M13](/packages/pentatrion-vite-bundle)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)[maba/webpack-bundle

Bundle to Integrate Webpack to Symfony

123268.2k4](/packages/maba-webpack-bundle)[jbtronics/settings-bundle

A symfony bundle to easily create typesafe, user-configurable settings for symfony applications

9546.7k2](/packages/jbtronics-settings-bundle)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)

PHPackages © 2026

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