This bundle helps you creating automatic and manual breadcrumbs for your Symfony project.
- php >= 8
- Symfony >= 6
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Open a command console, enter your project directory and execute:
$ composer require jugid/automatic-breadcrumbs-bundle
That's it !
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
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],
];
# config/packages/jugid_automatic_breadcrumbs.yaml
jugid_automatic_breadcrumbs: ~
That's it ! For more detailled options, visit the /docs
folder on this github repository.
Those examples are the simplest examples we can provide :
// src/Controller/MyController.php
use Jugid\AutomaticBreadcrumbs\Attribute\Breadcrumb;
#[Breadcrumb(title:'Index', root:true)]
#[Route('/', name: 'app_test')]
public function index(Breadcrumbs $b): Response
{
//...
}
// 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', []);
}
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