2017 © Pedro Peláez
 

library crumbler

Breadcrumb builder for Laravel 4

image

bad-mushroom/crumbler

Breadcrumb builder for Laravel 4

  • Saturday, April 26, 2014
  • by bad-mushroom
  • Repository
  • 0 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

# Crumbler

Crumbler is a breadcrumb trail generator for Laravel 4., (*1)

Install

Installation is done with composer., (*2)

Add the following to the composer.json file in your Laravel 4 project., (*3)

"require": {
    ...
    "bad-mushroom/Crumbler": "dev-master"
},

Next, update Composer:, (*4)

composer update

Now open app/config/app.php in your Laravel project to add the service provider:, (*5)

'providers' => array(
    ...
    'Badmushroom\Crumbler\CrumblerServiceProvider',
),

In the same file, add the facade alias:, (*6)

'aliases' => array(
    ...
    'Crumbler' => 'Badmushroom\Crumbler\Facades\Crumbler'
),

Use

There are two methods that you'll use., (*7)

To add a breadcrumb to your code use:, (*8)

Crumbler::crumb('Crumb Name', 'uri');

To generate the HTML for the crumb trail:, (*9)

Crumbler::build();

build() takes an optional string parameter for the breadcrumb separator. This can be a single character like '>' or a a line of html like <span class="myClass">::</span>. The default is: <span class="separator">/</span>, (*10)

As an example, in your controller file:, (*11)

// You can add some base breadcrumbs in your constructor.
public function __construct()
{
    Crumbler::crumb('1', 'one');
    Crumbler::crumb('2', 'two');
}

public function yourMethod()
{   
    Crumbler::crumb('3', 'three');
    $crumbs = Crumbler::build();

    return View::make('yourView')->with('crumbs', $crumbs);
}

The above example would output the following in your view:, (*12)

<ul class="crumbler">
    <li><a href="one">1</a><span class="separator">/</span></li>
    <li><a href="two">2</a><span class="separator">/</span></li>
    <li class="active">3</li>
</ul>

The last breadcrumb element will be considered the "active" link. You'll also want to add your own css as necessary., (*13)

License

http://opensource.org/licenses/MIT, (*14)

The Versions

26/04 2014

dev-master

9999999-dev

Breadcrumb builder for Laravel 4

  Sources   Download

MIT

The Requires

 

by Chris Sprague

breadcrumb