Download the PHP package slope-it/breadcrumb-bundle without Composer

On this page you can find all versions of the php package slope-it/breadcrumb-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package breadcrumb-bundle

SlopeItBreadcrumbBundle

Latest Stable Version Total Downloads License

This bundle provides a way to create "dynamic" breadcrumbs in your Symfony applications.

Installation

Composer is the only supported installation method. Run the following to install the latest version from Packagist:

Or, if you prefer, you can require any version in your composer.json:

Usage

1. Load bundle

Once installed, load the bundle in your Kernel class:

2. Define breadcrumbs

There are two ways to create a breadcrumb: via code (1) or via attributes (2).

Via code: you can inject the breadcrumb builder in your controller and add breadcrumb items:

Via attributes: just use the #[Breadcrumb] attribute at the class and/or method level. They will be merged (class comes first).

NOTE: The attribute can take either a single item (in the example it's done at the class level) or multiple items (in the example, at the method level).

3. Render breadcrumb

The last step is to use the following Twig function wherever you want the breadcrumb printed in your template:

Regardless of the way you used to create the breadcrumb, the result will be something like:

In which the first two items are anchors and the last one is text only.

Furthermore, in case you need to know whether the breadcrumb has items or not, you can use:

How the breadcrumb is generated

Under the hood, this is the business logic involved, for each item, in the breadcrumb generation:

NOTE: you don't need to pass all the route parameters that are needed by route, as long as these route parameters are already present in the URL for the current request. In other words, if your breadcrumb hierarchical structure somehow "matches" your URL structure.

Example: suppose you have the following routes, with parameters and resulting URLs:

If you are in the action for route children_edit and you want to generate a breadcrumb including all the above steps, you will be able to use the following annotation:

Note how you don't have to provide the route parameters (since the current request already has them all). It would work the same if you build it via code instead.

Override breadcrumb template

The bundle default template for rendering breadcrumb can be overridden by adding the following lines to the config.yml of your application:

If you intend to do this, it's recommended to copy Resources/views/breadcrumb.html.twig to your bundle and customize it. However, in your template you'll just have to iterate over the items variable to render your custom breadcrumb.

How to contribute

Under any of these circumstances, please fork this repo and create a pull request. We are more than happy to accept contributions!


All versions of breadcrumb-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
symfony/framework-bundle Version ^6.4|^7.0|^7.1
symfony/property-access Version ^6.4|^7.0|^7.1
symfony/translation Version ^6.4|^7.0|^7.1
symfony/yaml Version ^6.4|^7.0|^7.1
twig/twig Version ^2.10|^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package slope-it/breadcrumb-bundle contains the following files

Loading the files please wait ....