empyrean/breadcrumbs

Creates a breadcrumbs path to your current location.

2.01 2021-03-30 16:43 UTC

This package is auto-updated.

Last update: 2025-05-29 00:52:00 UTC


README

This is a Laravel package that will build up a nice presentation of your current url, more known as "Breadcrumbs"

http://domain.com/admin/users/create-new-user will turn into this:

Alt text

Installation

Install Breadcrumbs by running:

composer require empyrean/breadcrumbs

After that you will have to publish css files and BreadcrumbsServiceProvider by running:

php artisan vendor:publish (this will also add a vendor/breadcrumbs/breadcrumbs.css file to you public folder)

After this just include the link to the css file on any on page you want breadcrumbs to show up if you plan on using html provided by this package.

Usage

You will be able to get your breadcrumbs in 3 different ways

Breadcrumb::buildHtml() - this method will return full html 

Breadcrumb::buildParsedPath()->get() - this will split current url by "/" and return an array in case you want to stylelize breadcrumbs on your own. 

You can change the format of your parsedPath by calling format() method and then provding a format type like so:

Breadcrumb::buildParsedPath()->format(new Collection)->get()

You can also request links to all pages by calling withLinks() method like so:

Breadcrumb::buildParsedPath()->format(new Collection)->withLinks()->get()

Licence

MIT