diglactic/laravel-breadcrumbs
Laravel-style breadcrumbs for your app. Define trails in a single place, render them with built-in or custom templates, and support route-bound crumbs and structured data. Official fork of Dave James Miller’s original Laravel Breadcrumbs.
routes/breadcrumbs.php file, adhering to Laravel’s convention of separating concerns (routes, views, logic). This aligns well with Domain-Driven Design (DDD) and Feature-First architectures.{{ Breadcrumbs::render() }}) or accessed as collections (Breadcrumbs::generate()), accommodating headless or API-driven use cases.<head>; improper placement (e.g., in <body>) could trigger crawling issues.null URLs to avoid broken links.routes/breadcrumbs.php closures may require mocking or integration tests with HTTP clients.<nav> elements, JavaScript-based breadcrumbs).composer require diglactic/laravel-breadcrumbs
php artisan vendor:publish --tag=breadcrumbs-config
php artisan vendor:publish --tag=breadcrumbs-views
Breadcrumbs::for('home', fn($trail) => $trail->push('Home', route('home')));
Breadcrumbs::for('post', fn($trail, Post $post) =>
$trail->parent('blog')->push($post->title, route('post', $post))
);
get() with assertions on HTML output).@extends, @section, and @include.HandleInertiaRequests) for headless apps.routes/breadcrumbs.php before finalizing route names to avoid refactoring.routes/breadcrumbs.php), reducing runtime logic.Breadcrumbs::render() is called in the correct view with the right parameters.route() helpers for typos or missing route names.$breadcrumbs collection).@dump(Breadcrumbs::generate('post', $post)).dd() to inspect $trail objects in closures.push() loops (e.g., for nested categories).<head> (negligible impact).routes/breadcrumbs.php into multiple files (e.g., blog.php, admin.php) using service providers.How can I help you explore Laravel packages today?