{"id":20238743,"url":"https://github.com/dwightwatson/breadcrumbs","last_synced_at":"2025-04-10T19:35:41.485Z","repository":{"id":55959470,"uuid":"80588822","full_name":"dwightwatson/breadcrumbs","owner":"dwightwatson","description":"Breadcrumbs for Laravel, made easy.","archived":false,"fork":false,"pushed_at":"2020-12-04T10:15:11.000Z","size":54,"stargazers_count":45,"open_issues_count":4,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T17:13:45.759Z","etag":null,"topics":["breadcrumbs","laravel"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dwightwatson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-01T04:16:45.000Z","updated_at":"2025-03-15T20:58:37.000Z","dependencies_parsed_at":"2022-08-15T10:20:26.402Z","dependency_job_id":null,"html_url":"https://github.com/dwightwatson/breadcrumbs","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwightwatson%2Fbreadcrumbs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwightwatson%2Fbreadcrumbs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwightwatson%2Fbreadcrumbs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwightwatson%2Fbreadcrumbs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dwightwatson","download_url":"https://codeload.github.com/dwightwatson/breadcrumbs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281422,"owners_count":21077423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["breadcrumbs","laravel"],"created_at":"2024-11-14T08:35:34.665Z","updated_at":"2025-04-10T19:35:41.459Z","avatar_url":"https://github.com/dwightwatson.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Breadcrumbs for Laravel\n=======================\n\n## Warning: this package is currently incompatible with Laravel 7. I have started a rewrite that would support Laravel 7 but I have no ETA. You'll likely want to consider another breadcrumb package in the meantime.\n\n[![Build Status](https://travis-ci.org/dwightwatson/breadcrumbs.svg?branch=master)](https://travis-ci.org/dwightwatson/breadcrumbs)\n[![Total Downloads](https://poser.pugx.org/watson/breadcrumbs/downloads.svg)](https://packagist.org/packages/watson/breadcrumbs)\n[![License](https://poser.pugx.org/watson/breadcrumbs/license.svg)](https://packagist.org/packages/watson/breadcrumbs)\n\nBreadcrumbs is a simple breadcrumb generator for Laravel that tries to hook into the magic to make it easy to get up and running.\n\n## Installation\n\nRequire the package through Composer as per usual.\n\n```sh\n$ composer require watson/breadcrumbs\n```\n\n## Usage\n\nCreate a new file at `routes/breadcrumbs.php` to define your breadcrumbs. By default the package will work with named routes which works with resourceful routing. However, you're also free to define routes by the controller action/pair.\n\n```php\nBreadcrumbs::for('admin.pages.index', function ($trail) {\n    $trail-\u003eadd('Admin', route('admin.pages.index'));\n});\n\nBreadcrumbs::for('admin.users.index', function ($trail) {\n    $trail-\u003eparent('admin.pages.index');\n    $trail-\u003eadd('Users', route('admin.users.index'));\n});\n\nBreadcrumbs::for('admin.users.show', function ($trail, User $user) {\n    $trail-\u003eparent('admin.users.index');\n    $trail-\u003eadd($user-\u003efull_name, route('admin.users.show', $user));\n});\n\nBreadcrumbs::for('admin.users.edit', function ($trail, User $user) {\n    $trail-\u003eparent('admin.users.show', $user);\n    $trail-\u003eadd('Edit', route('admin.users.edit', $user));\n});\n\nBreadcrumbs::for('admin.users.roles.index', function ($trail, User $user) {\n    $trail-\u003eparent('admin.users.show', $user);\n    $trail-\u003eadd('Roles', route('admin.users.roles.index', $user));\n});\n\nBreadcrumbs::for('admin.users.roles.show', function ($trail, User $user, Role $role) {\n    $trail-\u003eparent('admin.users.roles.index', $user, $role);\n    $trail-\u003eadd('Edit', route('admin.users.roles.show', [$user, $role]));\n});\n```\n\nNote that you can call `parent()` from within a breadcrumb definition which lets you build up the breadcrumb tree. Pass any parameters you need further up through the second parameter.\n\nIf you want to use controller/action pairs instead of named routes that's fine too. Use the usual Laravel syntax and the package will correctly map it up for you. Note that if the route is named the package will always looked for a named breadcrumb first.\n\n```php\nBreadcrumbs::for('PagesController@getIndex', function ($trail) {\n    $trail-\u003eadd('Home', action('PagesController@getIndex'));\n});\n\nBreadcrumbs::for('secret.page', function ($trail) {\n    $trail-\u003eadd('Secret page', url('secret'))\n});\n```\n\n### Rendering the breadcrumbs\n\nIn your view file, you simply need to call the `render()` method wherever you want your breadcrumbs to appear. It's that easy. If there are no breadcrumbs for the current route, then nothing will be returned.\n\n```php\n{{ Breadcrumbs::render() }}\n```\n\nYou don't need to escape the content of the breadcrumbs, it's already wrapped in an instance of `Illuminate\\Support\\HtmlString` so Laravel knows just how to use it.\n\n### Multiple breadcrumb files\n\nIf you find that your breadcrumbs files is starting to get a little bigger you may like to break it out into multiple, smaller files. If that's the case you can simply `require` other breadcrumb files at the top of your default definition file.\n\n```php\nrequire 'breadcrumbs.admin.php';\n```\n\n### Customising the breadcrumb view\n\nThe package ships with a Bootstrap 3 compatible view which you can publish and customise as you need, or override completely with your own view. Simply run the following command to publish the view.\n\n```sh\n$ php artisan vendor:publish --provider=\"Watson\\Breadcrumbs\\ServiceProvider\" --tag=views\n```\n\nThis will publish the default `bootstrap3` view to your `resources/views/vendor/breadcrumbs` directory from which you can edit the file to your heart's content. If you want to use your own view instead, run the following command to publish the config file.\n\n```sh\n$ php artisan vendor:publish --provider=\"Watson\\Breadcrumbs\\ServiceProvider\" --tag=config\n```\n\nThis will publish `config/breadcrumbs.php` which provides you the option to set your own view file for your breadcrumbs.\n\n## Credits\n\nThis package is inspired by the work of [Dave James Miller](https://github.com/davejamesmiller/laravel-breadcrumbs), which I've used for some time. It has been re-written by scratch for my use case with a little more magic and less customisation, plus taking advantage of some newer features in PHP. Many thanks to Dave for his work.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwightwatson%2Fbreadcrumbs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdwightwatson%2Fbreadcrumbs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwightwatson%2Fbreadcrumbs/lists"}