PHPackages                             web-id/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. web-id/breadcrumb

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

web-id/breadcrumb
=================

Make breadcrumbs using a route macro

2.1.0(8mo ago)214.5k↓50%[3 PRs](https://github.com/web-id-fr/breadcrumb/pulls)MITPHPPHP ^8.2|^8.3CI passing

Since Jul 24Pushed 8mo ago5 watchersCompare

[ Source](https://github.com/web-id-fr/breadcrumb)[ Packagist](https://packagist.org/packages/web-id/breadcrumb)[ Docs](https://github.com/web-id-fr/breadcrumb)[ RSS](/packages/web-id-breadcrumb/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (12)Versions (24)Used By (0)

Breadcrumb
==========

[](#breadcrumb)

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

[](#installation)

You can install the package via composer:

```
composer require web-id/breadcrumb
```

### Publish config file

[](#publish-config-file)

```
php artisan vendor:publish --provider="WebId\Breadcrumb\BreadcrumbServiceProvider" --tag="config"
```

Usage
-----

[](#usage)

This package uses Spatie's Laravel Navigation package ().

### Frontend

[](#frontend)

If you are using Inertia, update the `frontend` key to the config file to `inertia`.

```
'frontend' => 'inertia',
```

If your project uses Blade templates, set the config to `blade`.

```
'frontend' => 'blade',
```

### Breadcrumb root element

[](#breadcrumb-root-element)

Edit the `breadcrumb_root` title and route name in your published `breadcrumb.php` config file.

For instance, if your root element is your homepage:

```
'breadcrumb_root' => [
        'title' => 'Homepage',
        'route_name' => 'homepage',
    ],
```

> **Note**
> Your route must be named.

### Breadcrumb class

[](#breadcrumb-class)

To create a new breadcrumb, create a class that extends the `WebId\Breadcrumb\Breadcrumb` class.

In this example, we will create a breadcrumb for the blog page (list of all articles):

```
use WebId\Breadcrumb\Breadcrumb;

class BlogBreadcrumb extends Breadcrumb
{
    public function index(): array
    {
        return $this->render(
            $this->baseBreadcrumb()
                ->add('Blog')
                ->tree()
        );
    }
}
```

Notice that the `add()` method only takes a name (blog). Indeed, the last element of a breadcrumb being the active page, you don't need to attach a link to it.

In this example, your view should have a `breadcrumb` key with this data:

```
[
    {
        "url": "https://www.yourwebsite.com",
        "title": "Homepage"
    },
    {
        "title": "Blog"
    }
]
```

If you want to create the breadcrumb for a single blog post, you probably want the parent element to be the blog page. In that case, add a method as follow:

```
public function show(Post $post): array
{
    return $this->render(
        $this->baseBreadcrumb()
            ->add('Blog', route('blog.index'))
            ->add($post->title, route('blog.show', ['post' => $post]))
            ->tree()
    );
}
```

> Notice that your can Typehint a model in your breadcrumb methods as if you were in a controller method.

In this example, your view should have a `breadcrumb` key with this data:

```
[
    {
        "url": "https://www.yourwebsite.com",
        "title": "Homepage"
    },
    {
        "url": "https://www.yourwebsite.com/blog",
        "title": "Blog"
    },
    {
        "title": "Article title"
    }
]
```

### Register a breadcrumb to a route

[](#register-a-breadcrumb-to-a-route)

In order for your breadcrumb to be accessible in your Inertia view, you have to register it to the associated route as follow:

```
Route::get('/blog', [BlogController::class, 'index'])->breadcrumb([BlogBreadcrumb:class, 'index']);
Route::get('/blog/{post}', [BlogController::class, 'show'])->breadcrumb([BlogBreadcrumb:class, 'show']);
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

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

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance61

Regular maintenance activity

Popularity27

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~95 days

Recently: every ~129 days

Total

13

Last Release

250d ago

Major Versions

1.2.4 → 2.0.02025-03-07

PHP version history (3 changes)1.0.0PHP ^8.1

1.2.1PHP ^8.2

v1.2.4.x-devPHP ^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/cefb02231110e801ec332d70b4bb7f1df97a12f095e0c1ea887d3273d74cde78?d=identicon)[web-id](/maintainers/web-id)

---

Top Contributors

[![charley-webid](https://avatars.githubusercontent.com/u/89599029?v=4)](https://github.com/charley-webid "charley-webid (6 commits)")[![benjaminniess](https://avatars.githubusercontent.com/u/1109647?v=4)](https://github.com/benjaminniess "benjaminniess (4 commits)")[![rygilles](https://avatars.githubusercontent.com/u/7666960?v=4)](https://github.com/rygilles "rygilles (4 commits)")[![E-Liegeois](https://avatars.githubusercontent.com/u/75976679?v=4)](https://github.com/E-Liegeois "E-Liegeois (3 commits)")[![JulienCauvin](https://avatars.githubusercontent.com/u/33349012?v=4)](https://github.com/JulienCauvin "JulienCauvin (3 commits)")[![cguenier](https://avatars.githubusercontent.com/u/13705811?v=4)](https://github.com/cguenier "cguenier (3 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelbreadcrumb

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/web-id-breadcrumb/health.svg)

```
[![Health](https://phpackages.com/badges/web-id-breadcrumb/health.svg)](https://phpackages.com/packages/web-id-breadcrumb)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

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