laravel-breadcrumbs

Easily add breadcrumbs to a Laravel app.

breadcrumbs.php
layout.blade.php
composer.json

Introduction

Introduction

Table of Contents

{note} You're browsing the documentation for an old version of laravel-breadcrumbs. Consider upgrading your project to v4. Check your version with the following command:

composer show rawilk/laravel-breadcrumbs

With Breadcrumbs for Laravel you can easily add breadcrumbs to your Laravel applications. This package works very similar to how the breadcrumbs package created by James Mills works. I created my own version of the package because the one by James Mills has been abandoned, and I want to continue to provide this kind of functionality in my own Laravel apps.

Here's a simple example of how you can define breadcrumbs, and then render them in a view:

// somewhere in a file defined in config/breadcrumbs.php.
// default: 'view' => base_path('routes/breadcrumbs.php')

use Rawilk\Breadcrumbs\Facades\Breadcrumbs;
use Rawilk\Breadcrumbs\Support\Generator;

// Home
Breadcrumbs::for('home', function (Generator $trail) {
    $trail->push('Home', route('home'));
});

// Home > About
Breadcrumbs::for('about', function (Generator $trail) {
    $trail->parent('home')->push('About', route('about'));
});

Now in a view somewhere, enter this:

<!-- will render a partial with links for Home > About -->
{!! Breadcrumbs::render('about') !!}

This package is not affiliated with, maintained, authorized, endorsed or sponsored by Laravel or any of its affiliates.

Caught a mistake? Suggest an edit on GitHub