PHPackages                             fragkp/laravel-route-breadcrumb - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. fragkp/laravel-route-breadcrumb

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fragkp/laravel-route-breadcrumb
===============================

4.0.0(5y ago)7011.7k↓50%9[1 PRs](https://github.com/fragkp/laravel-route-breadcrumb/pulls)MITPHPPHP ^7.4|^8.0CI failing

Since May 12Pushed 5y ago3 watchersCompare

[ Source](https://github.com/fragkp/laravel-route-breadcrumb)[ Packagist](https://packagist.org/packages/fragkp/laravel-route-breadcrumb)[ RSS](/packages/fragkp-laravel-route-breadcrumb/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (24)Used By (0)

Add breadcrumbs to your routes
==============================

[](#add-breadcrumbs-to-your-routes)

[![Latest Version](https://camo.githubusercontent.com/0960a9f2d306666fc6fea7fb38b85f5555ebb23db625f56aae8f4e9d546e80a1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f667261676b702f6c61726176656c2d726f7574652d62726561646372756d622e7376673f7374796c653d666c61742d737175617265)](https://github.com/fragkp/laravel-route-breadcrumb/releases)[![Total Downloads](https://camo.githubusercontent.com/842271012ae5304b6079b40d17a779e5b17d27f5d8c56f06707de7d4d45eaabc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f667261676b702f6c61726176656c2d726f7574652d62726561646372756d622e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fragkp/laravel-route-breadcrumb)

This package tries to give a simple solution for breadcrumbs. Add breadcrumbs direct to your routes and display them in your views.

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

[](#installation)

You can install the package via composer:

```
composer require fragkp/laravel-route-breadcrumb
```

If you want also use the facade to access the main breadcrumb class, add this line to your facades array in config/app.php:

```
'Breadcrumb' => Fragkp\LaravelRouteBreadcrumb\Facades\Breadcrumb::class,
```

This package contains some pre-built views for the most active css-frameworks:

- [Bootstrap 3](https://github.com/fragkp/laravel-route-breadcrumb/tree/master/resources/views/bootstrap3.blade.php)
- [Bootstrap 4](https://github.com/fragkp/laravel-route-breadcrumb/tree/master/resources/views/bootstrap4.blade.php)
- [Bulma](https://github.com/fragkp/laravel-route-breadcrumb/tree/master/resources/views/bulma.blade.php)
- [Foundation 6](https://github.com/fragkp/laravel-route-breadcrumb/tree/master/resources/views/foundation6.blade.php)

If you want to use one of these views, include it in this way:

```
@include('laravel-breadcrumb::bootstrap3')
```

To customize the pre-built views, run this command:

```
php artisan vendor:publish Fragkp\LaravelRouteBreadcrumb\BreadcrumbServiceProvider --tag=views
```

> Note: You could also create your own [custom view](#view-example) to display breadcrumb links.

Usage
-----

[](#usage)

### Defining breadcrumbs

[](#defining-breadcrumbs)

#### Basic

[](#basic)

To add a breadcrumb title to your route, call the `breadcrumb` method and pass your title.

```
Route::get('/')->breadcrumb('Your custom title');
```

#### Index

[](#index)

On some websites, you wish to have always an index inside your breadcrumbs. Use the `breadcrumbIndex` method. **This method should only be used once.**

> Note: `breadcrumbIndex` sets also the breadcrumb title for this route.

```
Route::get('/')->breadcrumbIndex('Start');

Route::get('/foo')->breadcrumb('Your custom title');
```

#### Inside groups

[](#inside-groups)

The `breadcrumb` method will also work inside route groups.

```
Route::get('/')->breadcrumbIndex('Start');

Route::prefix('/foo')->group(function () {
    Route::get('/bar')->breadcrumb('Your custom title');
});
```

#### Group index

[](#group-index)

Also, it is possible to specify a group index title by calling `breadcrumbGroup`. **This method should only be used once inside a group.**

> Note: `breadcrumbGroup` sets also the breadcrumb title for this route.

```
Route::get('/')->breadcrumbIndex('Start');

Route::prefix('/foo')->group(function () {
    Route::get('/')->breadcrumbGroup('Foo group index');

    Route::get('/bar')->breadcrumb('Your custom title');
});
```

#### Custom title resolver

[](#custom-title-resolver)

If you want to customize your breadcrumb title, you could pass a closure to all breadcrumb methods.

```
Route::get('/')->breadcrumb(function () {
    return 'Your custom title';
});
```

You could also pass a fully qualified class name. This will invoke your class.

```
Route::get('/')->breadcrumb(YourCustomTitleResolver::class);

class YourCustomTitleResolver
{
    public function __invoke()
    {
        return 'Your custom title';
    }
}
```

You may also pass a callable.

```
Route::get('/foo/{id}')->breadcrumb([app('my_breadcrumb_resolver'), 'resolve']);

// my_breadcrumb_resolver
class MyBreadcrumbResolver
{
    public function resolve($id)
    {
        $title = $this->repo->findById($id);

        return $title->getName();
    }
}
```

##### Route parameters

[](#route-parameters)

All route parameters will be passed to your resolver. Route model binding is also supported.

```
Route::get('/{foo}')->breadcrumb(YourCustomTitleResolver::class);

class YourCustomTitleResolver
{
    public function __invoke(Foo $foo)
    {
        return "Title: {$foo->title}";
    }
}
```

### Accessing breadcrumb

[](#accessing-breadcrumb)

#### Links

[](#links)

The `links` method will return a `Collection` of `BreadcrumbLink`.

> Note: The array is indexed by the uri.

```
app(Breadcrumb::class)->links(); // or use here the facade
```

Example result:

```
Illuminate\Support\Collection {#266
    #items: array:2 [
        "/" => Fragkp\LaravelRouteBreadcrumb\BreadcrumbLink {#41
            +uri: "/"
            +title: "Start"
        }
        "foo" => Fragkp\LaravelRouteBreadcrumb\BreadcrumbLink {#262
            +uri: "foo"
            +title: "Your custom title"
        }
    ]
}
```

#### Index

[](#index-1)

The `index` method will return a single instance of `BreadcrumbLink`. If you haven't defined any index, null is returned.

```
app(Breadcrumb::class)->index(); // or use here the facade
```

Example result:

```
Fragkp\LaravelRouteBreadcrumb\BreadcrumbLink {#36
    +uri: "/"
    +title: "Start"
}
```

#### Current

[](#current)

The `current` method will return a single instance of `BreadcrumbLink`. If no route is provided (e.g. on errors), null is returned.

```
app(Breadcrumb::class)->current(); // or use here the facade
```

Example result:

```
Fragkp\LaravelRouteBreadcrumb\BreadcrumbLink {#36
    +uri: "/"
    +title: "Your custom title"
}
```

#### View example

[](#view-example)

A good way to access the breadcrumb inside your views is to bound it via a View Composer.

> For more information about View Composers, have a look at the [Laravel docs](https://laravel.com/docs/5.6/views#view-composers).

```
// app/Providers/AppServiceProvider.php

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        View::composer('your-view', function ($view) {
            $view->with('breadcrumb', app(Breadcrumb::class)->links());
        });
    }
}
```

```
// resources/views/breadcrumb.blade.php

    @foreach ($breadcrumb as $link)

            {{ $link->title }}

    @endforeach

```

Testing
-------

[](#testing)

```
./vendor/bin/phpunit
```

License
-------

[](#license)

MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 92.9% 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

Every ~44 days

Recently: every ~122 days

Total

22

Last Release

1992d ago

Major Versions

1.0.1 → 2.0.02018-09-04

1.0.2 → 2.1.22018-09-12

1.0.3 → 2.1.32018-10-04

2.1.6 → 3.0.02019-09-04

3.0.2 → 4.0.02020-11-27

PHP version history (3 changes)0.1.0PHP ^7.0

3.0.0PHP ^7.2

4.0.0PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab1a1e195aa110e851a690adb6bd7363d965841591e7c631e0fd452bcf043943?d=identicon)[fragkp](/maintainers/fragkp)

---

Top Contributors

[![fragkp](https://avatars.githubusercontent.com/u/6986565?v=4)](https://github.com/fragkp "fragkp (39 commits)")[![dhazelett](https://avatars.githubusercontent.com/u/9557399?v=4)](https://github.com/dhazelett "dhazelett (2 commits)")[![liamseys](https://avatars.githubusercontent.com/u/10025985?v=4)](https://github.com/liamseys "liamseys (1 commits)")

---

Tags

breadcrumblaravellaravelroutebreadcrumb

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fragkp-laravel-route-breadcrumb/health.svg)

```
[![Health](https://phpackages.com/badges/fragkp-laravel-route-breadcrumb/health.svg)](https://phpackages.com/packages/fragkp-laravel-route-breadcrumb)
```

###  Alternatives

[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)[whitecube/laravel-timezones

Store UTC dates in the database and work with custom timezones in the application.

106106.2k](/packages/whitecube-laravel-timezones)[forxer/laravel-gravatar

A library providing easy gravatar integration in a Laravel project.

4235.6k](/packages/forxer-laravel-gravatar)[amendozaaguiar/filament-route-statistics

Filament route statictics viewer

3225.0k1](/packages/amendozaaguiar-filament-route-statistics)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)

PHPackages © 2026

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