Weave Code
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
Laravel Breadcrumbs

Laravel Breadcrumbs Laravel Package

diglactic/laravel-breadcrumbs

Laravel-style breadcrumb generator for modern Laravel apps. Define breadcrumb trails in code, render them with built-in or custom templates, support structured data and route-bound breadcrumbs, with advanced options and troubleshooting docs.

View on GitHub
Deep Wiki
Context7

Laravel Breadcrumbs - A simple Laravel-style way to create breadcrumbs.

Frequently asked questions about Laravel Breadcrumbs
How do I install diglactic/laravel-breadcrumbs in a Laravel project?
Run `composer require diglactic/laravel-breadcrumbs` to install the package. Publish the configuration and views with `php artisan vendor:publish --provider="Diglactic\Breadcrumbs\BreadcrumbsServiceProvider"` to customize templates and settings. No migrations or database changes are required.
What Laravel versions does this package support?
The package supports Laravel 8 through 13, with versioned releases ensuring compatibility. Check the [compatibility chart](https://github.com/diglactic/laravel-breadcrumbs#compatibility-chart) for specific version mappings. Older versions (Laravel 7 and below) require the original package.
How do I define breadcrumbs for a route in Laravel?
Use the `Breadcrumbs::for()` method in your route definitions (e.g., `routes/web.php`). Define breadcrumbs in a closure, passing route names, URLs, or dynamic data like Eloquent models. Example: `Breadcrumbs::for('home', function ($breadcrumbs) { $breadcrumbs->push('Home', route('home')); });`
Can I customize the HTML output of breadcrumbs?
Yes, the package supports custom templates. Publish the default views with `php artisan vendor:publish --tag=views` and modify the Blade templates in `resources/views/vendor/breadcrumbs`. Pre-built templates for Bootstrap, Bulma, and Tailwind are included for quick integration.
Does this package support structured data for SEO?
Yes, the package includes built-in support for JSON-LD structured data. Enable it in the config file (`config/breadcrumbs.php`) and ensure your templates include the `{{ Breadcrumbs::render('jsonld') }}` directive. This improves search engine understanding of your breadcrumb hierarchy.
How do I handle dynamic breadcrumbs (e.g., blog posts with categories)?
Use closures with route parameters. For example, `Breadcrumbs::for('post', function ($breadcrumbs, $post) { $breadcrumbs->push($post->category->name, route('category', $post->category)); $breadcrumbs->push($post->title, route('post', $post)); });` This dynamically generates breadcrumbs based on the passed model or data.
What happens if a breadcrumb route is undefined or 404s?
By default, the package silently skips undefined routes. To handle errors, configure the `onUndefinedRoute` option in `config/breadcrumbs.php` to throw exceptions or redirect. For production, consider logging undefined routes to catch issues early.
Can I cache breadcrumbs for better performance?
The package generates breadcrumbs on-demand, but you can cache the rendered output manually. Store the result of `Breadcrumbs::render()` in Laravel’s cache system (e.g., `Cache::remember()`) for high-traffic pages. Avoid caching dynamic breadcrumbs that rely on real-time data.
How do I test breadcrumb logic in Laravel?
Test breadcrumb definitions by asserting the rendered output in PHPUnit. Use `Breadcrumbs::render()` in your tests and compare it to expected HTML. For dynamic breadcrumbs, mock route parameters or Eloquent models to simulate real-world scenarios. Example: `$this->assertStringContainsString('Home', Breadcrumbs::render());`
Are there alternatives to this package for Laravel breadcrumbs?
Yes, alternatives include `spatie/laravel-breadcrumbs` (more feature-rich but heavier) and `way/generators` (for dynamic breadcrumbs). This package prioritizes simplicity and Laravel-native design, making it ideal for projects needing lightweight, maintainable breadcrumbs without complex dependencies.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4