{"id":15067112,"url":"https://github.com/blackdrago/laracrumbs","last_synced_at":"2026-02-20T19:03:44.684Z","repository":{"id":62494951,"uuid":"130617473","full_name":"blackdrago/laracrumbs","owner":"blackdrago","description":"A database-driven breadcrumb package for Laravel.","archived":false,"fork":false,"pushed_at":"2018-06-11T02:22:56.000Z","size":666,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T07:25:46.337Z","etag":null,"topics":["breadcrumbs","breadcrumbs-dynamic","database-driven-breadcrumbs","laravel","laravel5","laravel5-package"],"latest_commit_sha":null,"homepage":null,"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/blackdrago.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-22T23:50:48.000Z","updated_at":"2018-06-11T02:24:11.000Z","dependencies_parsed_at":"2022-11-02T11:46:08.536Z","dependency_job_id":null,"html_url":"https://github.com/blackdrago/laracrumbs","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/blackdrago/laracrumbs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackdrago%2Flaracrumbs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackdrago%2Flaracrumbs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackdrago%2Flaracrumbs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackdrago%2Flaracrumbs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blackdrago","download_url":"https://codeload.github.com/blackdrago/laracrumbs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackdrago%2Flaracrumbs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29661585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T16:33:43.953Z","status":"ssl_error","status_checked_at":"2026-02-20T16:33:43.598Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","breadcrumbs-dynamic","database-driven-breadcrumbs","laravel","laravel5","laravel5-package"],"created_at":"2024-09-25T01:16:45.874Z","updated_at":"2026-02-20T19:03:44.663Z","avatar_url":"https://github.com/blackdrago.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laracrumbs\nA database-driven breadcrumbs package for Laravel.\n\n# 1. Requirements\n- Laravel 5.6 (not tested with Laravel 5.0 to Laravel 5.5)\n- Laravel Mix\n\n# 2. Installation\n## 2.1. Install by Composer\nInstall via composer:\n```\ncomposer require blackdrago/laracrumbs\n```\n\nThen edit the application's config/app.php file and add the following:\n```php\n    'providers' =\u003e [\n        // ...\n        Laracrumbs\\ServiceProvider::class,\n        // ...\n    ],\n\n    // ...\n\n    'aliases' =\u003e [\n        // ...\n        'Laracrumbs' =\u003e Laracrumbs\\Facades\\Laracrumbs::class,\n        // ...\n    ],\n```\n\nRun the following commands:\n```\nphp artisan config:cache\nphp artisan vendor:publish --provider=\"Laracrumbs\\ServiceProvider\" --tag=config\ncomposer dump-autoload\nphp artisan migrate --path=vendor/blackdrago/laracrumbs/src/database/migrations/\n```\n\nCreate a file called **routes/laracrumbs.php** and define the application's Laracrumbs. (See below.)\n\n## 2.2. Configuration\nLaracrumbs have several configuration settings, including:\n\n- translation_key: a package prefix for translating language key values\n- template: the name of the Blade template to use for breadcrumbs\n- absolute_paths: boolean flag that indicates if absolute paths are used for routes\n\n# 3. Creating Laracrumbs\nThere are three kinds of Laracrumbs:\n\n1. **Basic**: A breadcrumb for a link or a route with no parameters.\n2. **Complex**: A breadcrumb for a route with at least one parameter.\n3. **Non-link**: A breadcrumb that serves as a category or marker but has no link.\n\nThe best way to create these is by making a new Database Seeder that can be packaged with the application:\n\n```\nphp artisan make:seeder LaracrumbsSeeder\n```\n\nThis will create the file *database/seeds/LaracrumbSeeder.php* where various Laracrumbs registrations can be made. Once completed, simply run the seeder command:\n\n```\nphp artisan db:seed --class=LaracrumbsSeeder\n```\n\n*Note*: If you get an error about Laravel not finding the seeder class, try running the following command:\n\n```\ncomposer dump-autoload\n```\n\nThen run the seeder command again.\n\nAn alternate method for handing Laracrumbs registeration is by creating a *Laracrumbs registration file* (e.g., routes/laracrumbs.php) and updating the files settings of *config/laracrumbs.php* to point to this file.\n\n## 3.1. Create a basic Laracrumb\nA basic Laracrumb can be for a link or a route with no parameters.\n\nRoutes:\n```php\nLaracrumbs::register([\n    'link' =\u003e url(route('home')),\n    'display_text' =\u003e 'Home',\n]);\nLaracrumbs::register([\n    'link' =\u003e url(route('browse')),\n    'display_text' =\u003e 'Browse',\n    'parent_id' =\u003e Laracrumb::findByLink(route('home'))-\u003eparent_id\n]);\n```\n\nLinks:\n```php\nLaracrumbs::register([\n    'link' =\u003e 'http://www.example.com',\n    'display_text' =\u003e 'Grandparent site',\n]);\nLaracrumbs::register([\n    'link' =\u003e 'http://www.anotherexample.com',\n    'display_text' =\u003e 'Parent site',\n    'parent_id' =\u003e Laracrumb::findByLink('http://www.example.com')-\u003eparent_id\n]);\n```\n\n## 3.2. Create a complex Laracrumb\nRoutes with parameters require complex Laracrumbs. Since a route with at least one parameter can produce multiple URLs, complex Laracrumbs require a mapping function.\n\nFor example, assume there are two models: Category and Product. There are also two corresponding 'detail view' routes. Registering them will look like this:\n```php\nLaracrumbs::register([\n    'route_name' =\u003e 'category-view',\n    'map' =\u003e 'category_laracrumb'\n]);\nLaracrumbs::register([\n    'route_name' =\u003e 'product-view',\n    'map' =\u003e 'product_laracrumb'\n]);\n```\n\nIf it's preferred, a function from within a class can be utilized instead:\n```php\nLaracrumbs::register([\n    'route_name' =\u003e 'category-view',\n    'map' =\u003e '\\App\\Models\\Category::laracrumb'\n]);\nLaracrumbs::register([\n    'route_name' =\u003e 'product-view',\n    'map' =\u003e '\\App\\Models\\Product::laracrumb'\n]);\n```\n\nExample of a complex Laracrumb mapping function for a Category model, which has Home as a parent:\n```php\nfunction category_laracrumb($route, $link)\n{\n    $params = $route-\u003eparameters();\n    $category = \\App\\Models\\Category::find((int)($params['id']));\n    if (!is_null($category)) {\n        $laracrumb = new \\Laracrumbs\\Models\\Laracrumb();\n        $laracrumb-\u003elink = $link;\n        $laracrumb-\u003edisplay_text = $category-\u003ename;\n        $laracrumb-\u003eparent_id = \\Laracrumbs::findParentId('home');\n        $laracrumb-\u003esave();\n        return $laracrumb;\n    }\n    return null;\n}\n```\n\nAnother example, for a Product model. It's parent is a Category specified by $product-\u003ecategory_id.\n```php\nfunction product_laracrumb($route, $link)\n{\n    $params = $route-\u003eparameters();\n    $product = \\App\\Models\\Product::find((int)($params['id']));\n    if (!is_null($product)) {\n        $laracrumb = new \\Laracrumbs\\Models\\Laracrumb();\n        $laracrumb-\u003elink = $link;\n        $laracrumb-\u003edisplay_text = $product-\u003ename;\n        $laracrumb-\u003eparent_id = \\Laracrumbs::findParentId('category-view', ['id' =\u003e $product-\u003ecategory_id]);\n        $laracrumb-\u003esave();\n        return $laracrumb;\n    }\n    return null;\n}\n```\n\n## 3.3. Create a non-link Laracrumb\nA non-link laracrumb does not have a route or a link associated with it, but rather serves as a marker or category. \n\nExample of non-link Laracrumb:\n```php\nLaracrumbs::register([\n    'display_text' =\u003e 'Getting Started',\n]);\nLaracrumbs::register([\n    'display_text' =\u003e 'Markup Tutorial',\n    'parent_id' =\u003e Laracrumbs::findParentIdByDisplayText('Getting Started')\n]);\n```\n\n# 4. Show Laracrumbs\nIf you don't have direct database access (or you don't want to use it), you can use the following console command to detect currently registered Laracrumbs:\n\n```\nphp artisan laracrumbs:show\n```\n\nThis will display all the existing/saved Laracrumbs as well as all the registered route maps.\n\n# 5. Configuration Settings\nOnce published, there will be *config/laracrumbs.php* file in your application. These settings enable you to customize Laracrumbs.\n\n## 5.1. Service Configuration Settings\n- files: one or more files that contain Laracrumb registration (if they exist)\n- translation_key: language pack/domain key for localization (if it exists)\n- template: the name of the Blade template to render Laracrumbs with\n- absolute_paths: boolean flag that indicates if absolute URLs are used\n\n## 5.2. View Configuration Settings\n- separator: the HTML markup that appears between laracrumbs\n- class_wrapper: the CSS class that wraps the full laracrumbs display\n- class_item: the CSS class that wraps the individual laracrumb\n- class_list: the CSS class that wraps the laracrumb list\n- class_list_item: the CSS class that wraps each laracrumb list item\n\nNote that the separator can be any HTML markup. By default it's the raquo (\u0026raquo;) HTML special character. If your application uses something like FontAwesome, however, you can change the separator to look like this:\n\n```php\n    'separator' =\u003e '\u003ci class=\"fa fa-chevron-right\" aria-hidden=\"true\"\u003e\u003c/i\u003e',\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackdrago%2Flaracrumbs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblackdrago%2Flaracrumbs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackdrago%2Flaracrumbs/lists"}