noith / customizable-breadcrumbs
Customizable breadcrumbs Blade component for Laravel
Requires
- php: ^8.2
- illuminate/support: ^12.0|^13.0
- illuminate/view: ^12.0|^13.0
Requires (Dev)
- orchestra/testbench: ^10.8|^11.0
- phpunit/phpunit: ^12.5
This package is auto-updated.
Last update: 2026-06-04 23:14:05 UTC
README
Breadcrumb navigation for Laravel 12–13. Bootstrap-compatible HTML, Schema.org JSON-LD, and a simple helper API.
Installation
composer require noith/customizable-breadcrumbs
The service provider is auto-discovered.
Usage
Add items anywhere in your controller, middleware, or view:
breadcrumb_add('Home', '/');
breadcrumb_add('Blog', '/blog');
breadcrumb_add('Post Title'); // no URL — renders as plain text
Render in your layout:
<x-customizable-breadcrumbs::breadcrumbs />
Both components skip rendering automatically when there are no items.
Schema.org
<x-customizable-breadcrumbs::schema-org />
Renders a <script type="application/ld+json"> tag with a BreadcrumbList. Items without a URL omit the item property, which is valid Schema.org.
For API responses or custom templates, get the data directly:
app(\Noith\Breadcrumbs\BreadcrumbsManager::class)->toSchemaArray();
Helper API
| Helper | Returns | Description |
|---|---|---|
breadcrumb_add($label, $url = '') | BreadcrumbsManager | Append item |
breadcrumb_prepend($label, $url = '') | BreadcrumbsManager | Prepend item |
breadcrumb_add_once($label, $url = '') | BreadcrumbsManager | Append only if label+url not already present |
breadcrumb_pop() | array\|null | Remove and return last item |
breadcrumb_last() | array\|null | Read last item without removing |
breadcrumb_items() | array | Return all items |
breadcrumb_clear() | void | Remove all items |
URL trimming is applied automatically — ' /path ' and '/path' are treated as identical.
Preventing duplicates
Useful when middleware and a controller both want to add the home breadcrumb:
// in middleware
breadcrumb_add_once('Home', '/');
// in controller — silently skipped
breadcrumb_add_once('Home', '/');
Editing the last item
breadcrumb_add('Draft title', '/posts/1');
// later, once the title is known:
breadcrumb_pop();
breadcrumb_add('Final title', '/posts/1');
Customising the template
Publish the views and edit them directly — there is no config file:
php artisan vendor:publish --tag=customizable-breadcrumbs-views
This copies both templates to resources/views/vendor/customizable-breadcrumbs/.
Long-running servers (Octane, RoadRunner)
BreadcrumbsManager is registered as a scoped binding — it is automatically reset at the start of each request. No additional configuration required.
Requirements
- PHP 8.2+
- Laravel 12 or 13