All Projects → dwightwatson → breadcrumbs

dwightwatson / breadcrumbs

Licence: MIT license
Breadcrumbs for Laravel, made easy.

Programming Languages

PHP
23972 projects - #3 most used programming language
Blade
752 projects

Projects that are alternatives of or similar to breadcrumbs

React Tunnels
🚇 Render React components in placeholders that are placed somewhere else in the component tree.
Stars: ✭ 398 (+765.22%)
Mutual labels:  breadcrumbs
Xng Breadcrumb
A lightweight, configurable and reactive breadcrumbs for Angular 2+
Stars: ✭ 106 (+130.43%)
Mutual labels:  breadcrumbs
Bugsnag Cocoa
Bugsnag crash reporting for iOS, macOS and tvOS apps
Stars: ✭ 167 (+263.04%)
Mutual labels:  breadcrumbs
Grav Plugin Breadcrumbs
Grav Breadcrumbs Plugin
Stars: ✭ 15 (-67.39%)
Mutual labels:  breadcrumbs
Bootstrap Breadcrumbs
Django template tags for easy breadcrumbs using twitter bootstrap css classes or custom template
Stars: ✭ 91 (+97.83%)
Mutual labels:  breadcrumbs
React Breadcrumbs Dynamic
🏡 > breadcrumbs > extremely flexible > and > easy to use
Stars: ✭ 116 (+152.17%)
Mutual labels:  breadcrumbs
Django Sitetree
Reusable application for Django introducing site tree, menu and breadcrumbs navigation elements.
Stars: ✭ 330 (+617.39%)
Mutual labels:  breadcrumbs
Honeybits
A PoC tool designed to enhance the effectiveness of your traps by spreading breadcrumbs & honeytokens across your systems to lure the attacker toward your honeypots
Stars: ✭ 222 (+382.61%)
Mutual labels:  breadcrumbs
Magento 2 Seo
Magento 2 SEO extension will do perfectly for your better SEO. This is a bundle of outstanding features that are auto-active when you install it from Mageplaza without any code modifications. It is also friendly with your store if you need to insert meta keywords and meta descriptions for your product.
Stars: ✭ 99 (+115.22%)
Mutual labels:  breadcrumbs
Structured Data Json Ld
Collection of structured data snippets in Google preferred JSON-LD format.
Stars: ✭ 157 (+241.3%)
Mutual labels:  breadcrumbs
Ng2 Breadcrumbs
A breadcrumb service for the Angular 7 router
Stars: ✭ 61 (+32.61%)
Mutual labels:  breadcrumbs
Wordpress Seo
Yoast SEO for WordPress
Stars: ✭ 1,301 (+2728.26%)
Mutual labels:  breadcrumbs
Raygun4js
JavaScript provider for Raygun
Stars: ✭ 124 (+169.57%)
Mutual labels:  breadcrumbs
Wp Structuring Markup
🔌 WordPress: Plug-in Markup (JSON-LD) structured in schema.org
Stars: ✭ 26 (-43.48%)
Mutual labels:  breadcrumbs
Breadcrumbs
Laravel Breadcrumbs - An easy way to add breadcrumbs to your @Laravel app.
Stars: ✭ 169 (+267.39%)
Mutual labels:  breadcrumbs
Loaf
Manages and displays breadcrumb trails in Rails app - lean & mean.
Stars: ✭ 360 (+682.61%)
Mutual labels:  breadcrumbs
Smartbreadcrumbs
A utility library for ASP.NET Core (both MVC and Razor Pages) websites to easily add and customize breadcrumbs.
Stars: ✭ 113 (+145.65%)
Mutual labels:  breadcrumbs
laravel5-breadcrumbs
Laravel 5 integration for our breadcrumbs package
Stars: ✭ 34 (-26.09%)
Mutual labels:  breadcrumbs
Krumbsview
🍞 The ultimate breadcrumbs view for Android!
Stars: ✭ 170 (+269.57%)
Mutual labels:  breadcrumbs
Vue Breadcrumbs
Breadcrumbs for Vue.js
Stars: ✭ 148 (+221.74%)
Mutual labels:  breadcrumbs

Breadcrumbs for Laravel

Warning: this package is currently incompatible with Laravel 7. I have started a rewrite that would support Laravel 7 but I have no ETA. You'll likely want to consider another breadcrumb package in the meantime.

Build Status Total Downloads License

Breadcrumbs is a simple breadcrumb generator for Laravel that tries to hook into the magic to make it easy to get up and running.

Installation

Require the package through Composer as per usual.

$ composer require watson/breadcrumbs

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.

Breadcrumbs::for('admin.pages.index', function ($trail) {
    $trail->add('Admin', route('admin.pages.index'));
});

Breadcrumbs::for('admin.users.index', function ($trail) {
    $trail->parent('admin.pages.index');
    $trail->add('Users', route('admin.users.index'));
});

Breadcrumbs::for('admin.users.show', function ($trail, User $user) {
    $trail->parent('admin.users.index');
    $trail->add($user->full_name, route('admin.users.show', $user));
});

Breadcrumbs::for('admin.users.edit', function ($trail, User $user) {
    $trail->parent('admin.users.show', $user);
    $trail->add('Edit', route('admin.users.edit', $user));
});

Breadcrumbs::for('admin.users.roles.index', function ($trail, User $user) {
    $trail->parent('admin.users.show', $user);
    $trail->add('Roles', route('admin.users.roles.index', $user));
});

Breadcrumbs::for('admin.users.roles.show', function ($trail, User $user, Role $role) {
    $trail->parent('admin.users.roles.index', $user, $role);
    $trail->add('Edit', route('admin.users.roles.show', [$user, $role]));
});

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.

Breadcrumbs::for('PagesController@getIndex', function ($trail) {
    $trail->add('Home', action('PagesController@getIndex'));
});

Breadcrumbs::for('secret.page', function ($trail) {
    $trail->add('Secret page', url('secret'))
});

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.

{{ Breadcrumbs::render() }}

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.

require 'breadcrumbs.admin.php';

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.

$ php artisan vendor:publish --provider="Watson\Breadcrumbs\ServiceProvider" --tag=views

This will publish the default bootstrap3 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.

$ php artisan vendor:publish --provider="Watson\Breadcrumbs\ServiceProvider" --tag=config

This will publish config/breadcrumbs.php which provides you the option to set your own view file for your breadcrumbs.

Credits

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].