Download the PHP package robotsinside/laravel-breadcrumbs without Composer

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

Laravel Breadcrumbs

Latest Version on Packagist Total Downloads CI License: MIT

A simple breadcrumbs implementation for Laravel with flexible class based segment customisation.

Table of contents

Installation

Depending on which version of Laravel you're on, you may need to specify which version to install.

Laravel Version Package Version
9.0 ^1.2
8.0 ^1.0
  1. Run composer require robotsinside/laravel-breadcrumbs.

  2. Optionally register the service provider in config/app.php

Auto-discovery is enabled, so this step can be skipped.

  1. Register the facade for use in your views in config/app.php

  2. Publish the config file php artisan vendor:publish --provider="RobotsInside\Breadcrumbs\BreadcrumbsServiceProvider" --tag="config"
  3. Publish the view files php artisan vendor:publish --provider="RobotsInside\Breadcrumbs\BreadcrumbsServiceProvider" --tag="views"

Usage

Once installed you can start rendering breadcrumbs immediately.

For example (using the Bootstrap 4 template) if the URL is http://example.test/about-us/team the output will be:

The following example includes an injected model.

The Post model will be automatically injected into the breadcrumbs class and the label that is used will depend on whether you have a breadcrumb label class defined for that model and which modelAttributes you have listed in your config file.

The modelAttributes key in the config file can be used to define a selection of model attributes for automatic resolution in your breadcrumbs (see Breadcrumb labels). For more complex situations, you can define a BreadcrumbLabel class as shown below. This class contains a model property which is resolved via the route model binding.

Don't forget to register your label classes as explained in Breadcrumb labels.

Configuration

The config file should be pretty self explanatory.

Templates

You have the option of choosing a pre-defined template, or creating your own. The provided options are:

If you want to provide your own breadcrumbs template, provide the name of your Blade template in the template option:

Breadcrumb mutators

If you want to define any breadcrumb mutator classes, you need to provide the namespace where the Mutator classes are located. By default this is set to App\\Breadcrumbs\\Mutators\\, but you can change it to suit your project requirements.

Breadcrumb labels

In my own projects I often use name and title model attributes as my breadcrumb labels. Having to define custom breadcrumb labels in these trivial situations is cumbersome. Instead you can define a modelAttributes array in the config file to take care of that.

If your model matches multiple attributes in this array, the left-most database attribute will be used.

To define some more complex logic for your breadcrumb labels you will need to provide a mapping for your Model => BreadcrumbLabel classes in config/breadcrumbs.php.

Removing nodes

Let's say you have an admin area in your app, in that case you probably want to remove the admin segment from your breadcrumbs.

You can achieve this by defining a mutator and calling the remove method in the mutate method. The remove method expects an array, so you can remove multiple nodes if needed.

If the URL is http://example.test/admin/posts/my-post, breadcrumbs will render:

Adding nodes

If for some reason you need to add one or more nodes, you can do that too.

You can achieve this by defining a mutator and calling the add method in the mutate method, for example:

If the URL is http://example.test/my-post, breadcrumbs will render:

Package removal

To remove the package:

  1. Remove the facade in config/app.php
  2. Delete the path/to/Breadcrumbs directory from your application
  3. Delete all {{ Breadcrumbs::render }} statements in your views
  4. Delete config/breadcrumbs.php
  5. Run composer remove robotsinside/laravel-breadcrumbs

When I developed this package I was faced with a decision on how to let users customise their breadcrumbs. Initally I though I would provide a BreadcrumbsInteface that would need to be implemented on Model classes, but later decided against it since that would mean implementing methods on all of your models that have breadcrumb labels.

Instead, I opted for a config array mapping since that would be easier to remove at a later date if you decide to remove this package from your project at a later date.

Todo

  1. Write tests
  2. Finish README

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

Coffee Time

Will work for :coffee::coffee::coffee:

Buy Me A Coffee

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-breadcrumbs with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
illuminate/database Version ^6.0|^8.0|^9.0
illuminate/support Version ^6.0|^8.0|^9.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 robotsinside/laravel-breadcrumbs contains the following files

Loading the files please wait ....