PHPackages                             mikamatto/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. [Templating &amp; Views](/categories/templating)
4. /
5. mikamatto/breadcrumbs-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

mikamatto/breadcrumbs-bundle
============================

A Symfony bundle for managing breadcrumbs.

v1.0.0(1y ago)029MITPHPPHP &gt;=8.0

Since Nov 5Pushed 1y ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (2)Used By (0)

BreadcrumbsBundle
=================

[](#breadcrumbsbundle)

`Mikamatto\BreadcrumbsBundle` is a Symfony bundle that provides easy-to-configure breadcrumbs functionality using a YAML file. It supports a simple, chain-based breadcrumb structure and includes caching for optimized performance.

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

[](#installation)

Use Composer to install the bundle:

```
composer require mikamatto/breadcrumbs-bundle
```

Configuration
-------------

[](#configuration)

By default, the breadcrumbs configuration file should be located at `config/packages/breadcrumbs.yaml`. The structure inside this file should start with a breadcrumbs\_bundle root key, as follows:

```
breadcrumbs_bundle:
  routes:
    app_page_index:
      label: 'Pages'

    app_page_edit:
      label: 'Edit Page'
      chain: ['app_page_index']

    app_page_new:
      label: 'New Page'
      chain: ['app_page_index']

    app_page_show:
      label: 'Page Details'
      chain: ['app_page_index']
```

Each route is defined by:

- **label**: The breadcrumb label which will be rendered in the breadcrumb.
- **chain**: Optional. Defines the chain of preceding routes (as an array of route names) which will be rendered recursively.

### Custom File Path

[](#custom-file-path)

If you prefer a custom file name, you can specify it in your configuration file as follows:

```
breadcrumbs_bundle:
  breadcrumbs_file: '%kernel.project_dir%/config/custom_breadcrumbs.yaml'
  routes:
    ...
```

**Note:** If you use a custom filename but do not specify it in the configuration, the bundle will work; however, caching will default to config/packages/breadcrumbs.yaml, which may lead to outdated breadcrumbs being displayed. Defining the path explicitly ensures cache invalidation occurs correctly.

This approach maintains flexibility while ensuring caching behaves as expected for any filename or location.

Usage
-----

[](#usage)

### 1. Twig Function

[](#1-twig-function)

Use the Twig function `getBreadcrumbs()` to retrieve the breadcrumb chain for the current route.

```
{% for breadcrumb in getBreadcrumbs() %}
    {{ breadcrumb.label }}
    {% if not loop.last %} > {% endif %}
{% endfor %}
```

This will output something like:

```
Home > Pages > Page Details

```

Note: To keep things lighter, the common root ‘Home’ can be hardcoded in Twig instead of being defined in each route chain.

### 2. Service: BreadcrumbsProcessor

[](#2-service-breadcrumbsprocessor)

You can also access the underlying service: the bundle exposes a `BreadcrumbsProcessor` service, which generates breadcrumb arrays for a given route.

Inject the service (Mikamatto\\BreadcrumbsBundle\\Service\\BreadcrumbsProcessor) and call generateBreadcrumbs():

```
public function index(BreadcrumbsProcessor $breadcrumbsProcessor)
{
    $breadcrumbs = $breadcrumbsProcessor->generateBreadcrumbs('app_page_show', ['id' => 1]);
    // Result based on example YAML above:
    // [
    //     ['label' => 'Pages', 'url' => '/page/'],
    //     ['label' => 'Page Details', 'url' => '/page/1']
    // ]
}
```

Caching
-------

[](#caching)

The bundle caches the breadcrumbs YAML file for performance. When the YAML file changes, the cache automatically invalidates and updates. A dedicated cache pool is used, defined in your bundle’s service configuration.

Example Output
--------------

[](#example-output)

The output of `getBreadcrumbs()` in Twig (or `generateBreadcrumbs()` as a service) will look like this:

```
[
    ['label' => 'Pages', 'url' => '/page/'],
    ['label' => 'Page Details', 'url' => '/page/1']
]
```

Summary
-------

[](#summary)

- Breadcrumbs YAML configuration defines route labels and chains.
- Service `BreadcrumbsProcessor` generates breadcrumbs for specified routes.
- Twig function `getBreadcrumbs()` automatically provides breadcrumbs for the current route.
- Caching is automatically managed on YAML changes for optimized performance.

This structure allows you to integrate breadcrumbs easily with flexible customization options.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Unknown

Total

1

Last Release

551d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9b68bfb1904d505c75e0f3b866df0a96719bcb8268a7574ea249eb7cb76dd510?d=identicon)[mikamatto](/maintainers/mikamatto)

---

Top Contributors

[![mikamatto](https://avatars.githubusercontent.com/u/45991183?v=4)](https://github.com/mikamatto "mikamatto (1 commits)")

---

Tags

symfonybundletwignavigationbreadcrumbs

### Embed Badge

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

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

###  Alternatives

[yellowskies/qr-code-bundle

Symfony Barcode &amp; QR Code Generator Bundle with Twig extension

36682.9k](/packages/yellowskies-qr-code-bundle)[nucleos/antispam-bundle

This bundle provides some basic features to reduce spam in symfony forms.

52105.1k](/packages/nucleos-antispam-bundle)[cg/kint-bundle

This bundle lets you use the Kint function in your Twig templates. Kint is a print\_r() replacement which produces a structured, collapsible and escaped output

22125.8k1](/packages/cg-kint-bundle)

PHPackages © 2026

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