Download the PHP package nomiscz/laravel-breadcrumbs without Composer
On this page you can find all versions of the php package nomiscz/laravel-breadcrumbs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nomiscz/laravel-breadcrumbs
More information about nomiscz/laravel-breadcrumbs
Files in nomiscz/laravel-breadcrumbs
Package laravel-breadcrumbs
Short Description Breadcrumbs made easy for Laravel.
License MIT
Informations about the package laravel-breadcrumbs
Breadcrumbs for Laravel [Fork]
Breadcrumbs is a simple breadcrumb generator for Laravel that tries to hook into the magic to make it easy to get up and running. It ships with support for Bootstrap 3 and 4 (with 4 the default) but it's easy to drop in your own view instead.
Installation
Require the package through Composer as per usual.
Usage
Create a new file at routes/breadcrumbs.php
to define your breadcrumbs. By default the package will work with named routes which works with resourceful routing. However, you're also free to define routes by the controller action/pair.
Note that you can call parent()
from within a breadcrumb definition which lets you build up the breadcrumb tree. Pass any parameters you need further up through the second parameter.
If you want to use controller/action pairs instead of named routes that's fine too. Use the usual Laravel syntax and the package will correctly map it up for you. Note that if the route is named the package will always looked for a named breadcrumb first.
Rendering the breadcrumbs
In your view file, you simply need to call the render()
method wherever you want your breadcrumbs to appear. It's that easy. If there are no breadcrumbs for the current route, then nothing will be returned.
You don't need to escape the content of the breadcrumbs, it's already wrapped in an instance of Illuminate\Support\HtmlString
so Laravel knows just how to use it.
Multiple breadcrumb files
If you find that your breadcrumbs files is starting to get a little bigger you may like to break it out into multiple, smaller files. If that's the case you can simply require
other breadcrumb files at the top of your default definition file.
Customising the breadcrumb view
The package ships with a Bootstrap 3 compatible view which you can publish and customise as you need, or override completely with your own view. Simply run the following command to publish the view.
This will publish the default bootstrap4
view to your resources/views/vendor/breadcrumbs
directory from which you can edit the file to your heart's content. If you want to use your own view instead, run the following command to publish the config file.
This will publish config/breadcrumbs.php
which provides you the option to set your own view file for your breadcrumbs.
Credits
Original author of this package is Dwight Watson. This package is inspired by the work of Dave James Miller, which I've used for some time. It has been re-written by scratch for my use case with a little more magic and less customisation, plus taking advantage of some newer features in PHP. Many thanks to Dave for his work.
All versions of laravel-breadcrumbs with dependencies
illuminate/routing Version ^7.0
illuminate/support Version ^7.0
illuminate/view Version ^7.0