Download the PHP package alshenetsky/easyadmin-breadcrumbs without Composer

On this page you can find all versions of the php package alshenetsky/easyadmin-breadcrumbs. 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 easyadmin-breadcrumbs

easyadmin-breadcrumbs

A bundle that allows you to add breadcrumbs to EasyAdmin

Installation

This bundle requires EasyAdmin 4.5 or higher, PHP 8.0 or higher and Symfony 5.4 or higher. Run the following command to install it in your application:

Documentation

Concept

EasyAdmin, as we know, does not have functionality for placing breadcrumbs on admin pages. Navigation in the admin area is based on the GET request data, packed into a class named AdminContext. Transitions between controller methods are implemented by generating the URL to the desired CRUD and, if necessary, applying filters to it. So it becomes difficult to build a breadcrumb tree, because you need to somehow store the hierarchy of controllers without losing filters and controllers' connections to each other.

This bundle allows you to recreate such a hierarchy. You create a Breadcrumb class, which in turn creates a reference to the parent Breadcrumb, and so on.

Creating breadcrumb hierarchy

Such a class must implement the BreadcrumbInterface. The easiest way to do it is to inherit the AbstractBreadcrumb class, which already implements this interface and contains useful methods, reducing the number of boilerplate:

Every Breadcrumb class will match against current url by getType() and getEntityFqdn() methods. So the breadcrumb from this example will appear on the UserController::index page.

Method getType() returns BreadcrumbType enum which is perfectly matched with Crud::PAGE_* constants in EasyAdmin bundle.

Additionally, you can implement supports() method if you need more complex logic whether to display breadcrumb on the page:

Let's go deeper into the navigation tree. Where there is a list of users, there will most likely be a user edit. Let's create a second level breadcrumb:

You may see some previously unfamiliar methods.

That's it. Now we have two levels of breadcrumb navigation:

Users -> Editing user John Doe

Now go deeper. Assume that on the user's edit page we have a link to the user's orders, which are displayed in the OrdersController. Assume that on the user's edit page we have a link to the user's orders, which are displayed in the OrdersController. Most likely you'll make a custom Action on the user's edit page and create a link for it that leads to OrdersController::index and sets a filter for it ('user' => ['comparison' => '=', 'value' => $user->getId()]]). It is easy to breadcrumb the next level of nesting:

Users -> Editing user John Doe -> User orders

The last method you should know about is provide(). It also receives BreadcrumbData which is gathered in gather(), but returns another BreadcrumbData class to populate parent breadcrumb with it. You SHOULD provide very same keys that your parent breadcrumb needs.

You see, being on a different page (in a different context) invokes gather() method only on the current breadcrumb, and the parent breadcrumbs get theirs BreadcrumbData via the provide() method up the chain. This is how the breadcrumb hierarchy is formed. You can form as many nesting levels as you wish.

Summary:

Handling exceptions

By using EasyAdmin filters when displaying a list of child items, you may find that when you reset the filters, you end up outside the breadcrumb structure. To avoid encountering 500 errors, throw a BreadcrumbNotApplicableException in any of the configure, gather, or provide methods. This error will be handled correctly and the breadcrumbs will not be rendered.

Placing breadcrumbs on the page:

  1. Override EadyAdmin layout.html twig template by creating file templates/bundles/EasyAdminBundle/layout.html.twig
  2. Place {{ breadcrumbs() }} there, in content_header_wrapper block for example:

Contribution

Contributions are very welcome!

TODO list:

License

This software is published under the MIT License


All versions of easyadmin-breadcrumbs with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
easycorp/easyadmin-bundle Version ^4.5
symfony/dependency-injection Version ^5.4|^6.0|^7.0
symfony/http-kernel Version ^5.4|^6.0|^7.0
symfony/config Version ^5.4|^6.0|^7.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 alshenetsky/easyadmin-breadcrumbs contains the following files

Loading the files please wait ....