Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Breadcrumbs Bundle Laravel Package

xi/breadcrumbs-bundle

A lightweight breadcrumbs bundle for PHP applications that helps generate, configure, and render hierarchical navigation trails. Add breadcrumb definitions to your existing stack to improve site navigation and user orientation with minimal setup.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Reality check first: this is a Symfony2-era bundle, not a Laravel package. If you are working in a Laravel codebase you will not composer require it — you will read it as a reference implementation for route-tree breadcrumbs and port the pattern into a Laravel service provider / middleware. The score (2.43) and 10 stars reflect that it is niche and effectively unmaintained.
  • Where to look first: the bundle's README.md, then Resources/config/services.xml (service IDs and listener wiring), then the routing loader / defaults handling that reads breadcrumb metadata from routes, and finally the Twig template under Resources/views. Those four files tell you the whole contract: how parentage is declared, how labels resolve, and how the trail is rendered.
  • Minimal setup (Symfony2): add the package via Composer, register the bundle in AppKernel, enable it in config.yml, then annotate or configure routes so each route knows its parent and a display label. Render the trail in your layout with the bundle's Twig helper (confirm the exact function name in the bundle's Twig extension).
  • First use case: a three-level tree — home → product_list → product_show. Instead of calling $breadcrumbs->add(...) in every controller action, you declare the parent/label relationship once in routing config and let a request listener build the trail from the current route. The win is that controllers stay thin and the trail stays consistent across pages.

Implementation Patterns

  • Route-as-tree authoring: declare breadcrumb metadata in route defaults (or annotations) rather than in PHP. The canonical shape is a parent route name plus a label; the bundle walks upward from the matched route. Keep the tree shallow (3–4 levels) — deep chains become hard to reason about and expensive to resolve on every request.
  • Centralize static labels, resolve dynamic ones: put fixed labels ("Products", "Account") in route config. For parameterized routes (/orders/{id}), do not try to encode a label in routing — resolve it at runtime via a small service or listener that sets the label on the request/collector after the entity is loaded. This keeps IDs and entity titles out of routing files.
  • Thin controllers: the whole point of the package is to avoid $this->addBreadcrumb() calls in actions. If you find yourself adding breadcrumbs manually per action, you have either a route-tree edge case or a dynamic-label case — handle both in a listener/mapper, not in the controller.
  • Twig integration: render the trail once in the base layout. The bundle's Twig extension returns a structured list; iterate it to emit <ol>/<nav aria-label="breadcrumb"> markup. Do not hardcode separators in the extension — override the bundle template in app/Resources/ to keep markup and styling under your control.
  • Caching the tree: route collections are cached by Symfony. Build the trail from the cached route metadata, not from live database lookups in the listener. If you need entity titles, cache those separately keyed by route + id.
  • Laravel port pattern (if applicable): register a singleton BreadcrumbManager, populate it in a middleware after route resolution, declare parent/label metadata alongside routes (->defaults('breadcrumb', [...])), and expose a Blade component that iterates the trail. The structural idea transfers cleanly; the bundle code does not.

Gotchas and Tips

  • Framework lock-in: written for Symfony2. It will not install or run on Symfony 4+ without patching (service definitions, event dispatcher signatures, templating changes). Treat it as a design reference if you are on modern Symfony or Laravel.
  • License is NOASSERTION: the repository does not declare a recognized OSI license. Verify with the maintainer before shipping it in a commercial product; absent clarification, do not copy code verbatim.
  • Unmaintained and low-adoption: 10 stars, 0 dependents, no security support. Budget for reading the source rather than relying on docs, and expect no upstream fixes.
  • Silent breakage on route renames: because parentage is by route name string, renaming a route breaks the trail without an error — it simply truncates. Add a functional test that asserts the expected trail for your key pages.
  • Parameterized routes: placeholders like {id} leaking into labels is the most common bug. Always override labels for dynamic routes at runtime; never rely on the raw route pattern.
  • Listener ordering and registration: the collector depends on the router having matched a request. If the bundle is registered before routing or the listener priority is wrong, you get empty trails. Debug by dumping $request->attributes->get('_route') in a kernel request listener.
  • Cache clearing: after editing breadcrumb defaults, clear the Symfony cache — route metadata is cached and stale config produces confusing results.
  • Extension points: the cleanest override is a custom breadcrumb builder/listener registered at higher priority than the bundle's, or a decorated service that post-processes the trail. Prefer that over editing vendor code.
  • Don't over-engineer: if your app has only a handful of hierarchical pages, a 20-line helper that maps route names to labels is lower risk than adopting an unmaintained bundle. The package earns its keep only when breadcrumbs genuinely mirror a large, stable route hierarchy.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource