Skip to content

JuGid/automatic-breadcrumbs

Repository files navigation

Automatic Breadcrumbs Bundle

codecov

This bundle helps you creating automatic and manual breadcrumbs for your Symfony project.

Compatibility

  • php >= 8
  • Symfony >= 6

Installation

Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.

Applications that use Symfony Flex

Open a command console, enter your project directory and execute:

$ composer require jugid/automatic-breadcrumbs-bundle

That's it !

Applications that don't use Symfony Flex

Step 1 : Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require jugid/automatic-breadcrumbs-bundle

Step 2 : Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

// config/bundles.php

return [
    // ...
    Jugid\AutomaticBreadcrumbs\AutomaticBreadcrumbsBundle::class => ['all' => true],
];

Step 3 : Configure the bundle in config/packages/jugid_automatic_breadcrumbs.yaml:

# config/packages/jugid_automatic_breadcrumbs.yaml
jugid_automatic_breadcrumbs: ~

That's it ! For more detailled options, visit the /docs folder on this github repository.

Examples

Those examples are the simplest examples we can provide :

When breadcrumbs are created automatically :

// src/Controller/MyController.php

use Jugid\AutomaticBreadcrumbs\Attribute\Breadcrumb;

#[Breadcrumb(title:'Index', root:true)]
#[Route('/', name: 'app_test')]
public function index(Breadcrumbs $b): Response
{
    //...
}

When breadcrumbs are created manually :

// src/Controller/MyController.php

use Jugid\AutomaticBreadcrumbs\Breadcrumbs;

#[Route('/', name: 'app_index')]
public function index(Breadcrumbs $breadcrumbs): Response
{
    $breadcrumbs
        ->getCollection()
        ->addItem('Github', 'http://github.com')
    ;

    return $this->render('index.html.twig', []);
}

Help needed

  • [tests] Unit tests (#1)
  • [feature] More views (#2)
  • [feature] PHP7 compatibility (#3)

Contributing

We welcome contributions to this project, including pull requests and issues (and discussions on existing issues).

Originally created for Suitvie (bêta 0.3.0) Inspired by mhujer/BreadcrumbsBundle

About

Symfony bundle to create automatic and manual breadcrumbs

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published