PHP code example of chamber-orchestra / breadcrumbs

1. Go to this page and download the library: Download chamber-orchestra/breadcrumbs library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

chamber-orchestra / breadcrumbs example snippets


use ChamberOrchestra\Breadcrumbs\Breadcrumbs;

$breadcrumbs = new Breadcrumbs();
$breadcrumbs
    ->addCrumb('Home', 'app_home')
    ->addCrumb('Products', 'app_products', ['category' => 'books'])
    ->addCrumb('Current Page');

$breadcrumbs->addRequestCrumb('Current Page', $request);

$breadcrumbs->addCrumb('Home', 'app_home', [], prepend: true);

$breadcrumbs->addCrumbsClosure(function (Breadcrumbs $crumbs) {
    $crumbs->addCrumb('Home', 'app_home');
    $crumbs->addCrumb('About', 'app_about');
});

$first = $breadcrumbs[0];
$total = count($breadcrumbs);