PHPackages                             robotsinside/laravel-breadcrumbs - 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. robotsinside/laravel-breadcrumbs

ActiveLibrary

robotsinside/laravel-breadcrumbs
================================

Simple breadcrumb implementation for Laravel.

1.2.0(4y ago)19851MITPHPPHP ^7.2|^8.0CI failing

Since Aug 2Pushed 2y agoCompare

[ Source](https://github.com/robotsinside/laravel-breadcrumbs)[ Packagist](https://packagist.org/packages/robotsinside/laravel-breadcrumbs)[ Docs](https://github.com/robotsinside/laravel-breadcrumbs)[ RSS](/packages/robotsinside-laravel-breadcrumbs/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

Laravel Breadcrumbs
===================

[](#laravel-breadcrumbs)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3edc6e61e28a855e64ee0dabf2fc2ba546399943cc4cbb86d72d445a0614c9a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f626f7473696e736964652f6c61726176656c2d62726561646372756d62732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/robotsinside/laravel-breadcrumbs)[![Total Downloads](https://camo.githubusercontent.com/0b2081b0fa2f76b9efb6f4885e9a69c5f092f81295159dc3c458a99e2e821abd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f626f7473696e736964652f6c61726176656c2d62726561646372756d62732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/robotsinside/laravel-breadcrumbs)[![CI](https://github.com/robotsinside/laravel-breadcrumbs/actions/workflows/laravel.yml/badge.svg)](https://github.com/robotsinside/laravel-breadcrumbs/actions/workflows/laravel.yml/badge.svg)[![License: MIT](https://camo.githubusercontent.com/458425f8985b0b0c8a736cffe75e05a098e3d77906acddbcad2bfc54492a4e02/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e7376673f7374796c653d666c61742d737175617265)](https://opensource.org/licenses/MIT)

A simple breadcrumbs implementation for Laravel with flexible class based segment customisation.

Table of contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [Configuration](#configuration)
    - [Templates](#templates)
    - [Breadcrumb mutators](#breadcrumb-mutators)
    - [Breadcrumb labels](#-a-name--breadcrumblabels----a--breadcrumb-labels)
    - [Removing nodes](#removing-nodes)
    - [Adding nodes](#adding-nodes)
- [Package removal](#package-removal)
- [Todo](#todo)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [Security](#security)
- [Credits](#credits)
- [Coffee Time](#coffee-time)
- [License](#license)

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

[](#installation)

Depending on which version of Laravel you're on, you may need to specify which version to install.

Laravel VersionPackage Version9.0^1.28.0^1.01. Run `composer require robotsinside/laravel-breadcrumbs`.
2. Optionally register the service provider in `config/app.php`

```
/*
* Package Service Providers...
*/
\RobotsInside\Breadcrumbs\BreadcrumbsServiceProvider::class,
```

Auto-discovery is enabled, so this step can be skipped.

3. Register the facade for use in your views in `config/app.php`

```
    'aliases' => [
        ...
        'Breadcrumbs' => \RobotsInside\Breadcrumbs\Facades\Breadcrumbs::class,
    ],
```

4. Publish the config file `php artisan vendor:publish --provider="RobotsInside\Breadcrumbs\BreadcrumbsServiceProvider" --tag="config"`
5. Publish the view files `php artisan vendor:publish --provider="RobotsInside\Breadcrumbs\BreadcrumbsServiceProvider" --tag="views"`

Usage
-----

[](#usage)

Once installed you can start rendering breadcrumbs immediately.

```

    {{ Breadcrumbs::render() }}

```

For example (using the Bootstrap 4 template) if the URL is `http://example.test/about-us/team` the output will be:

```
+-----------+-------------------------------+-----------------------+---------------------------------------------------------------+
| Method    | URI                           | Name                  | Action                                                        |
+-----------+-------------------------------+-----------------------+---------------------------------------------------------------+
| GET|HEAD  | about-us/team                 | about.team            | Closure                                                       |
```

```

                Home

                About us

                Team

```

The following example includes an injected model.

```
+-----------+-------------------------------+-----------------------+---------------------------------------------------------------+
| Method    | URI                           | Name                  | Action                                                        |
+-----------+-------------------------------+-----------------------+---------------------------------------------------------------+
| GET|HEAD  | posts/{post}                  | posts.show            | App\App\Posts\Controllers\PostController@show                 |
```

The `Post` model will be automatically injected into the breadcrumbs class and the label that is used will depend on whether you have a breadcrumb label class defined for that model and which `modelAttributes` you have listed in your config file.

The `modelAttributes` key in the config file can be used to define a selection of model attributes for automatic resolution in your breadcrumbs (see [Breadcrumb labels](#breadcrumbLabels)). For more complex situations, you can define a `BreadcrumbLabel` class as shown below. This class contains a `model` property which is resolved via the route model binding.

```
