PHPackages                             blackdrago/laracrumbs - 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. blackdrago/laracrumbs

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

blackdrago/laracrumbs
=====================

Laracrumbs provides database-driven breadcrumbs for Laravel.

v1.1.0(7y ago)014PHP

Since May 7Pushed 7y ago1 watchersCompare

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

READMEChangelog (5)Dependencies (1)Versions (7)Used By (0)

Laracrumbs
==========

[](#laracrumbs)

A database-driven breadcrumbs package for Laravel.

1. Requirements
===============

[](#1-requirements)

- Laravel 5.6 (not tested with Laravel 5.0 to Laravel 5.5)
- Laravel Mix

2. Installation
===============

[](#2-installation)

2.1. Install by Composer
------------------------

[](#21-install-by-composer)

Install via composer:

```
composer require blackdrago/laracrumbs

```

Then edit the application's config/app.php file and add the following:

```
    'providers' => [
        // ...
        Laracrumbs\ServiceProvider::class,
        // ...
    ],

    // ...

    'aliases' => [
        // ...
        'Laracrumbs' => Laracrumbs\Facades\Laracrumbs::class,
        // ...
    ],
```

Run the following commands:

```
php artisan config:cache
php artisan vendor:publish --provider="Laracrumbs\ServiceProvider" --tag=config
composer dump-autoload
php artisan migrate --path=vendor/blackdrago/laracrumbs/src/database/migrations/

```

Create a file called **routes/laracrumbs.php** and define the application's Laracrumbs. (See below.)

2.2. Configuration
------------------

[](#22-configuration)

Laracrumbs have several configuration settings, including:

- translation\_key: a package prefix for translating language key values
- template: the name of the Blade template to use for breadcrumbs
- absolute\_paths: boolean flag that indicates if absolute paths are used for routes

3. Creating Laracrumbs
======================

[](#3-creating-laracrumbs)

There are three kinds of Laracrumbs:

1. **Basic**: A breadcrumb for a link or a route with no parameters.
2. **Complex**: A breadcrumb for a route with at least one parameter.
3. **Non-link**: A breadcrumb that serves as a category or marker but has no link.

The best way to create these is by making a new Database Seeder that can be packaged with the application:

```
php artisan make:seeder LaracrumbsSeeder

```

This will create the file *database/seeds/LaracrumbSeeder.php* where various Laracrumbs registrations can be made. Once completed, simply run the seeder command:

```
php artisan db:seed --class=LaracrumbsSeeder

```

*Note*: If you get an error about Laravel not finding the seeder class, try running the following command:

```
composer dump-autoload

```

Then run the seeder command again.

An alternate method for handing Laracrumbs registeration is by creating a *Laracrumbs registration file* (e.g., routes/laracrumbs.php) and updating the files settings of *config/laracrumbs.php* to point to this file.

3.1. Create a basic Laracrumb
-----------------------------

[](#31-create-a-basic-laracrumb)

A basic Laracrumb can be for a link or a route with no parameters.

Routes:

```
Laracrumbs::register([
    'link' => url(route('home')),
    'display_text' => 'Home',
]);
Laracrumbs::register([
    'link' => url(route('browse')),
    'display_text' => 'Browse',
    'parent_id' => Laracrumb::findByLink(route('home'))->parent_id
]);
```

Links:

```
Laracrumbs::register([
    'link' => 'http://www.example.com',
    'display_text' => 'Grandparent site',
]);
Laracrumbs::register([
    'link' => 'http://www.anotherexample.com',
    'display_text' => 'Parent site',
    'parent_id' => Laracrumb::findByLink('http://www.example.com')->parent_id
]);
```

3.2. Create a complex Laracrumb
-------------------------------

[](#32-create-a-complex-laracrumb)

Routes with parameters require complex Laracrumbs. Since a route with at least one parameter can produce multiple URLs, complex Laracrumbs require a mapping function.

For example, assume there are two models: Category and Product. There are also two corresponding 'detail view' routes. Registering them will look like this:

```
Laracrumbs::register([
    'route_name' => 'category-view',
    'map' => 'category_laracrumb'
]);
Laracrumbs::register([
    'route_name' => 'product-view',
    'map' => 'product_laracrumb'
]);
```

If it's preferred, a function from within a class can be utilized instead:

```
Laracrumbs::register([
    'route_name' => 'category-view',
    'map' => '\App\Models\Category::laracrumb'
]);
Laracrumbs::register([
    'route_name' => 'product-view',
    'map' => '\App\Models\Product::laracrumb'
]);
```

Example of a complex Laracrumb mapping function for a Category model, which has Home as a parent:

```
function category_laracrumb($route, $link)
{
    $params = $route->parameters();
    $category = \App\Models\Category::find((int)($params['id']));
    if (!is_null($category)) {
        $laracrumb = new \Laracrumbs\Models\Laracrumb();
        $laracrumb->link = $link;
        $laracrumb->display_text = $category->name;
        $laracrumb->parent_id = \Laracrumbs::findParentId('home');
        $laracrumb->save();
        return $laracrumb;
    }
    return null;
}
```

Another example, for a Product model. It's parent is a Category specified by $product-&gt;category\_id.

```
function product_laracrumb($route, $link)
{
    $params = $route->parameters();
    $product = \App\Models\Product::find((int)($params['id']));
    if (!is_null($product)) {
        $laracrumb = new \Laracrumbs\Models\Laracrumb();
        $laracrumb->link = $link;
        $laracrumb->display_text = $product->name;
        $laracrumb->parent_id = \Laracrumbs::findParentId('category-view', ['id' => $product->category_id]);
        $laracrumb->save();
        return $laracrumb;
    }
    return null;
}
```

3.3. Create a non-link Laracrumb
--------------------------------

[](#33-create-a-non-link-laracrumb)

A non-link laracrumb does not have a route or a link associated with it, but rather serves as a marker or category.

Example of non-link Laracrumb:

```
Laracrumbs::register([
    'display_text' => 'Getting Started',
]);
Laracrumbs::register([
    'display_text' => 'Markup Tutorial',
    'parent_id' => Laracrumbs::findParentIdByDisplayText('Getting Started')
]);
```

4. Show Laracrumbs
==================

[](#4-show-laracrumbs)

If you don't have direct database access (or you don't want to use it), you can use the following console command to detect currently registered Laracrumbs:

```
php artisan laracrumbs:show

```

This will display all the existing/saved Laracrumbs as well as all the registered route maps.

5. Configuration Settings
=========================

[](#5-configuration-settings)

Once published, there will be *config/laracrumbs.php* file in your application. These settings enable you to customize Laracrumbs.

5.1. Service Configuration Settings
-----------------------------------

[](#51-service-configuration-settings)

- files: one or more files that contain Laracrumb registration (if they exist)
- translation\_key: language pack/domain key for localization (if it exists)
- template: the name of the Blade template to render Laracrumbs with
- absolute\_paths: boolean flag that indicates if absolute URLs are used

5.2. View Configuration Settings
--------------------------------

[](#52-view-configuration-settings)

- separator: the HTML markup that appears between laracrumbs
- class\_wrapper: the CSS class that wraps the full laracrumbs display
- class\_item: the CSS class that wraps the individual laracrumb
- class\_list: the CSS class that wraps the laracrumb list
- class\_list\_item: the CSS class that wraps each laracrumb list item

Note that the separator can be any HTML markup. By default it's the raquo (») HTML special character. If your application uses something like FontAwesome, however, you can change the separator to look like this:

```
    'separator' => '',
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~7 days

Total

6

Last Release

2889d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0319a1f92da69f5cbf49332179b52aa2efcc1b42c62cf3583bc82b0749a26b01?d=identicon)[blackdrago](/maintainers/blackdrago)

---

Top Contributors

[![blackdrago](https://avatars.githubusercontent.com/u/924076?v=4)](https://github.com/blackdrago "blackdrago (24 commits)")

---

Tags

breadcrumbsbreadcrumbs-dynamicdatabase-driven-breadcrumbslaravellaravel5laravel5-package

### Embed Badge

![Health badge](/badges/blackdrago-laracrumbs/health.svg)

```
[![Health](https://phpackages.com/badges/blackdrago-laracrumbs/health.svg)](https://phpackages.com/packages/blackdrago-laracrumbs)
```

###  Alternatives

[tightenco/ziggy

Use your Laravel named routes in JavaScript.

4.3k41.6M267](/packages/tightenco-ziggy)[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)[nickurt/laravel-akismet

Akismet for Laravel 11.x/12.x/13.x

97139.6k2](/packages/nickurt-laravel-akismet)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)

PHPackages © 2026

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