vienasbaitas/breadcrumbs

Simple package to generate breadcrumbs.

1.0.0 2020-08-24 11:29 UTC

This package is auto-updated.

Last update: 2024-11-21 15:20:33 UTC


README

This package allows you to add simple and easy breadcrumb management to your project.

Installation

composer require vienasbaitas/breadcrumbs:^1.0

Usage

In order to use breadcrumbs you need to create new instance, after that just push new items to it.

$breadcrumbs = new \VienasBaitas\Breadcrumbs\Breadcrumbs();

$breadcrumbs->item('Dashboard')->path('/dashboard');
$breadcrumbs->item('Settings')->path('/settings');
$breadcrumbs->item('Blog')->path('/blog')->target(\VienasBaitas\Breadcrumbs\BreadcrumbItem::TARGET_BLANK);

After container has been initialized you can return whole breadcrumbs object to your view, alternatively you can use built-in array renderer to render it as an array.

$renderer = new \VienasBaitas\Breadcrumbs\Renderers\ArrayRenderer();

$asArray = $renderer->render($breadcrumbs);

Available methods

VienasBaitas\Breadcrumbs\Breadcrumbs

VienasBaitas\Breadcrumbs\BreadcrumbItem