Download the PHP package robertboes/inertia-breadcrumbs without Composer
On this page you can find all versions of the php package robertboes/inertia-breadcrumbs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download robertboes/inertia-breadcrumbs
More information about robertboes/inertia-breadcrumbs
Files in robertboes/inertia-breadcrumbs
Package inertia-breadcrumbs
Short Description Laravel package to automatically share breadcrumbs to Inertia
License MIT
Homepage https://github.com/robertboes/inertia-breadcrumbs
Informations about the package inertia-breadcrumbs
Laravel package to automatically share breadcrumbs to Inertia
This package automatically shares breadcrumbs as Inertia props in a standardized way, with support for multiple breadcrumb packages.
Installation
You can install the package via composer:
You can publish the config file with:
Next step is to install one of the following packages to manage your breadcrumbs:
Configure your breadcrumbs as explained by the package
Update your config/inertia-breadcrumbs.php
configuration to use the correct collector:
Usage
No matter which third party package you're using, this package will always share breadcrumbs to Inertia in the following format:
[!NOTE] Note that due to package differences, URLs are always present when using
glhd/gretel
, but are otherwise optional.
An example to render your breadcrumbs in Vue 3 could look like the following:
Using a classifier
A classifier is used to determine when breadcrumbs should be shared as Inertia props.
By default all breadcrumbs are shared, but this package is shipped with the IgnoreSingleBreadcrumbs
classifier, which simply discards a breadcrumb collection containing only one route.
To write your own classifier you'll have to implement RobertBoes\InertiaBreadcrumbs\BreadcrumbCollection\ClassifierContract
and update the inertia-breadcrumbs.classifier
config, for example:
Serializing breadcrumbs
In some cases you might not like the default way breadcrumbs are serialized.
To modify the way the breadcrumbs are being sent to the frontend you can register a serialize callback
in the boot
method of a service provider:
Including the query string when determining the current URL
By default, the query string will be ignored when determining the current url, meaning a breadcrumb defined for /users/{id}
will match both /users/1
and /users/1?foo=bar
. To change this behaviour and include the query string (meaning /users/1?foo=bar
will not be seen as the current page), change ignore_query
to false
in the config/inertia-breadcrumbs.php
file.
Notes on using glhd/gretel
glhd/gretel
shares the breadcrumbs automatically if it detects Inertia is installed and shares the props with the same key (breadcrumbs
). If you want to use this package with gretel you should disable their automatic sharing by updating the config:
Testing
Upgrading
For notable changes see UPGRADING.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Robert Boes
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of inertia-breadcrumbs with dependencies
illuminate/contracts Version ^10.0|^11.0
inertiajs/inertia-laravel Version ^1.0|^2.0
spatie/laravel-package-tools Version ^1.11.0