2017 © Pedro Peláez
 

library breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

image

phalcon/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  • Thursday, May 24, 2018
  • by phalcon
  • Repository
  • 8 Watchers
  • 35 Stars
  • 6,432 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 8 Forks
  • 1 Open issues
  • 13 Versions
  • 15 % Grown

The README.md

Phalcon Breadcrumbs ![Build Status][:travis-badge:]

Breadcrumbs Screenshot, (*1)

Phalcon Breadcrumbs is a powerful and flexible component for building site breadcrumbs. You can adapt it to your own needs or improve it if you want., (*2)

Please write us if you have any feedback., (*3)

Thanks!, (*4)

NOTE

The master branch will always contain the latest stable version. If you wish to check older versions or newer ones currently under development, please switch to the relevant branch/tag., (*5)

Getting Started

Requirements

To use this component, you need at least:, (*6)

NOTE: Support for legacy PHP versions (down to 7.0) is provided on a best-effort basis., (*7)

Installing

$ composer require sergeyklay/breadcrumbs

Define your breadcrumbs

We recommend registering it with your application's services for even easier use:, (*8)

setShared('breadcrumbs', function () {
    return new Breadcrumbs;
});
```

**Adding a crumb with a link:**

```php
breadcrumbs->add('Home', '/');
```

**Adding a crumb without a link (normally the last one):**

```php
breadcrumbs->add('User', null, ['linked' => false]);
```

**Output crumbs:**

Php Engine
```html

Volt Engine, (*9)

<ol class="breadcrumb">
  {{ breadcrumbs.output() }}
</ol>

Change crumb separator:, (*10)

<?php

$this->breadcrumbs->setSeparator(' &raquo; ');

Make The last element is always not a link:, (*11)

<?php

$this->breadcrumbs->setLastNotLinked(true);

Delete a crumb (by url):, (*12)

<?php

$this->breadcrumbs->remove('/admin/user/create');

// remove a crumb without an url
$this->breadcrumbs->remove(null);

Update an existing crumb:, (*13)

<?php

$this->breadcrumbs->update('/admin/user/remove', ['label' => '<strong class="red">Remove</strong>']);

Count crumbs:, (*14)

<?php

$this->breadcrumbs->count();

Sets rendering template:, (*15)

<?php

$this->breadcrumbs->setTemplate(
    '<li><a href="{{link}}">{{icon}}{{label}}</a></li>', // linked
    '<li class="active">{{icon}}{{label}}</li>',         // not linked
    '<i class="fa fa-dashboard"></i>'                    // first icon
);

Multi-language support:, (*16)

<?php

use Phalcon\Translate\Adapter\NativeArray as Translator;
use Phalcon\Breadcrumbs;

$messages = [
    'crumb-home'     => 'Home',
    'crumb-user'     => 'User',
    'crumb-settings' => 'Settings',
    'crumb-profile'  => 'Profile',
];

// Initialize the Translate adapter.
$di->setShared('translate', function () use ($messages) {
    return new Translator(['content' => $messages]);
});

// Initialize the Breadcrumbs component.
$di->setShared('breadcrumbs', function () {
    return new Breadcrumbs;
});

Errors logging:, (*17)

<?php

use Phalcon\Logger\Formatter\Line as FormatterLine;
use Phalcon\Logger\Adapter\File as FileLogger;
use Phalcon\Breadcrumbs;

/**
 * Initialize the Logger.
 *
 * @var $config array
 * @var $di \Phalcon\Di
 */
$di->setShared('logger', function ($filename = null, $format = null) use ($config) {
    $formatter = new FormatterLine($config->get('logger')->format, $config->get('logger')->date);
    $logger = new FileLogger($config->get('logger')->path . $config->get('logger')->filename);

    $logger->setFormatter($formatter);
    $logger->setLogLevel($config->get('logger')->logLevel);

    return $logger;
});

// Initialize the Breadcrumbs component.
$di->setShared('breadcrumbs', function () {
    return new Breadcrumbs;
});

Events

<?php

use Phalcon\Breadcrumbs;
use Phalcon\Events\Manager as EventsManager;

// Initialize the Events Manager.
$di->setShared('eventsManager', function () {
    return new EventsManager;
});

// Initialize the Breadcrumbs component.
$di->setShared('breadcrumbs', function () use ($di) {
    $manager = $di->getShared('eventsManager');
    $manager->attach('breadcrumbs', function ($event, $connection) {
        // We stop the event if it is cancelable
        if ($event->isCancelable()) {
            // Stop the event, so other listeners will not be notified about this
            $event->stop();
        }

        // Receiving the data from the event context
        print_r($event->getData());
    });

    $breadcrumbs = new Breadcrumbs;
    $breadcrumbs->setEventsManager($manager);

    return $breadcrumbs;
});

Available events:, (*18)

breadcrumbs:beforeAdd
breadcrumbs:afterAdd
breadcrumbs:beforeOutput
breadcrumbs:afterOutput
breadcrumbs:beforeTranslate
breadcrumbs:afterTranslate
breadcrumbs:beforeLogging
breadcrumbs:afterLogging
breadcrumbs:beforeRemove
breadcrumbs:afterRemove
breadcrumbs:beforeUpdate
breadcrumbs:afterUpdate
breadcrumbs:beforeSetTemplate
breadcrumbs:afterSetTemplate

Phalcon Breadcrumbs is open-sourced software licensed under the New BSD License. © Serghei Iakovlev, (*19)

The Versions

24/05 2018

dev-master

9999999-dev https://github.com/phalcon/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • ext-phalcon >=2.0 <4.0
  • php >= 5.5 <8.0

 

The Development Requires

phalcon breadcrumbs crumbs

24/05 2018

v1.4.0

1.4.0.0 https://github.com/phalcon/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.5 <8.0
  • ext-phalcon >=2.0 <4.0

 

The Development Requires

phalcon breadcrumbs crumbs

24/05 2018

dev-development

dev-development https://github.com/phalcon/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • ext-phalcon >=2.0 <4.0
  • php >= 5.5 <8.0

 

The Development Requires

phalcon breadcrumbs crumbs

20/01 2018

v1.3.4

1.3.4.0 https://github.com/phalcon/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.5 <8.0
  • ext-phalcon >=2.0 <4.0

 

The Development Requires

phalcon breadcrumbs crumbs

21/10 2017

v1.3.3

1.3.3.0 https://github.com/phalcon/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.5 <7.2
  • ext-phalcon >=2.0 <4.0

 

The Development Requires

phalcon breadcrumbs crumbs

10/09 2017

v1.3.2

1.3.2.0 https://github.com/phalcon/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.5 <7.2
  • ext-phalcon >=2.0 <4.0

 

The Development Requires

phalcon breadcrumbs crumbs

18/04 2017

v1.3.1

1.3.1.0 https://github.com/phalcon/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.5 <7.2
  • ext-phalcon >=2.0 <4.0

 

The Development Requires

phalcon breadcrumbs crumbs

10/04 2017

v1.3.0

1.3.0.0 https://github.com/phalcon/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.5 <7.2
  • ext-phalcon >=2.0 <4.0

 

The Development Requires

phalcon breadcrumbs crumbs

20/12 2016

v1.2.1

1.2.1.0 https://github.com/phalcongelist/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.5
  • ext-phalcon >=2.0 <4.0

 

The Development Requires

phalcon breadcrumbs crumbs

26/03 2016

v1.2.0

1.2.0.0 https://github.com/phalcongelist/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.4
  • ext-phalcon >=2.0

 

The Development Requires

phalcon breadcrumbs crumbs

12/03 2016

v1.1.1

1.1.1.0 https://github.com/phalcongelist/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.4
  • ext-phalcon >=2.0

 

The Development Requires

phalcon breadcrumbs crumbs

21/02 2016

v1.1.0

1.1.0.0 https://github.com/phalcongelist/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.4
  • ext-phalcon >=2.0

 

The Development Requires

phalcon breadcrumbs crumbs

21/02 2016

v1.0.0

1.0.0.0 https://github.com/phalcongelist/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.4
  • ext-phalcon >=2.0

 

The Development Requires

phalcon breadcrumbs crumbs