You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+81-27Lines changed: 81 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,9 @@
1
1

2
2
3
-
# Quick and easy breadcrumbs for Laravel
4
-
5
-
**Note:** This is very much a work in progress and should not be used on any live site.
6
-
7
3
[](https://packagist.org/packages/aelora/laravel-breadcrumbs)
We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).
19
-
20
-
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).
6
+
Quickly build breadcrumb trails for your pages in Laravel and automatically output the HTML and JSON-LD schema metadata.
// In your view where ever your want the breadcrumbs
75
+
{!! $breadcrumbs !!}
60
76
```
61
77
78
+
You can also call `$breadcrumbs->generate()` for the same effect. `Breadcrumbs` implements `Stringable` and has a `__toString()` method, so you don't need to. The `__toString()` calls `generate()`.
79
+
80
+
Note that we're using `{!!` and `!!}` instead of `{{` and `}}`. We don't want the contents of the breadcrumbs to be escaped.
81
+
82
+
### Home Page
83
+
84
+
You don't need to explicitly add your home page to the breadcrumbs. With the default config, it will be added automatically as the first element before output. If you don't want to include the home page link you can set `home.include` to `false` in the config file or call `setHome(false)` when you're creating the breadcrumbs.
Adds a new breadcrumb link on the end of the current stack.
91
+
92
+
The only required parameter is `$title`. Breadcrumbs will only be links if `$url` is not empty. If it is, `$title` will display unlinked. `$image` is a link to an image for the breadcrumb. It's currently only used in the schema metadata and not in the visible HTML output, although it could be if you build your own view.
93
+
94
+
`public function count()`
95
+
96
+
Returns the number of breadcrumb items, not counting the home link.
97
+
98
+
`public static function create()`
99
+
100
+
Returns a new instance so you can build on one line without having to call `new Breadcrumbs()`.
101
+
102
+
`public function generate($echo = false)`
103
+
104
+
Returns the generated breadcrumbs, both the visible HTML and schema metadata. If `$echo` is `true` then the breadcrumbs will also be echoed prior to return.
105
+
106
+
`public function reset()`
107
+
108
+
Clears the breadcrumb trail.
109
+
110
+
`public function reverse()`
111
+
112
+
Reverses the internal breadcrumb trail. Sometimes it's easier to build the trail backwards and then flip it at the end.
0 commit comments