Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Bread Laravel Package

bjerke/laravel-bread

Laravel Bread is a small package for adding breadcrumb navigation to Laravel applications. Define breadcrumb trails and render them in Blade views to give users a clear sense of location and hierarchy, with simple configuration and helper methods.

View on GitHub
Deep Wiki
Context7

Getting Started

This is a boilerplate/scaffold, not a runtime framework. Treat it the way you'd treat a starter kit: you pull it in, generate or copy code out of it, then own that code. The day-one goal is to get one model exposed over a REST API with the full Browse/Read/Edit/Add/Delete surface, then replicate the pattern.

  1. Install and inspect.

    composer require bjerke/laravel-bread:^4.0
    

    The package is back under active maintenance (v4.0.1), but there's a multi-year gap between the 2022 releases and the 4.x line, so treat 4.x as a new baseline rather than a continuation. Before writing code:

    • Read the 4.0.0 release notes/changelog first. A major bump after a long dormancy almost always carries breaking changes (namespace moves, PHP/Laravel minimums, renamed config keys) that no older tutorial or blog post will reflect.
    • Check composer.json in the package for illuminate/* constraints and the PHP floor against your Laravel version.
    • Open src/ and read the base controller/abstract class first — that's the contract you'll be extending.
    • Look for stubs/, config/, and src/Console/ — boilerplate packages usually ship an artisan generator and publishable config.
    • Run php artisan vendor:publish --provider="Bjerke\Bread\..." (confirm the provider FQCN from src/) to pull config/stubs into your app.
  2. First use case: expose a simple CRUD model — e.g. Post — as a REST resource. Define the route with the package's route helper or a standard Route::apiResource, point it at a controller that extends the package's base controller, and implement the five BREAD handlers. Give Post a relation (e.g. author) so you exercise the relation search/display-field path that 4.0.1 touched.

  3. Where to look next: the README's example controller, then src/ for the trait/base class that implements the shared browse/read/edit/add/delete logic. If the package registers routes or middleware automatically, check php artisan route:list before hand-rolling routes.

Implementation Patterns

Extend, don't compose. Boilerplate packages of this shape usually expose an abstract controller or a trait that provides the five operations. The idiomatic flow is:

class PostController extends BreadController
{
    protected string $model = \App\Models\Post::class;
    protected string $resource = PostResource::class;
    protected array $searchable = ['title', 'body', 'author.name'];
    protected array $with = ['author'];
}

Verify the actual property/method names in src/ — this is the part of the package you'll be reading rather than remembering.

Relations need a display field. 4.0.1 fixed a typo in the searchField handling for relations, which is the mechanism that auto-sets the field used to render/search a related model (so a Browse listing can show author.name instead of an id, and search across it). When you expose a relation:

  • Confirm the related model resolves a sensible display field (a name/title column) — if it doesn't, filtering and dropdown-style UI will show ids.
  • If you'd already worked around the old typo by hand-setting the display field on the model or in the controller, remove that workaround so the package default applies, then re-check the output.

Keep BREAD separate from CRUD. The "Browse" operation is the differentiator from plain resource controllers: it's a listing endpoint with pagination, filtering, sorting, and eager-loading. Put filter validation in a dedicated form request and scope it to a query builder rather than letting arbitrary ?filter= keys hit where().

Route shape. Prefer explicit resource routes over auto-registration so you can attach per-verb middleware:

Route::apiResource('posts', PostController::class)
    ->middleware(['auth:sanctum']);

If the package ships a route macro or registration helper, use it only if it doesn't hide middleware you need to customize.

Validation at the boundary. Wrap Add/Edit in FormRequest classes with authorize() returning your policy check. Boilerplate defaults rarely include authorization — that's on you, and it's the most common place these scaffolds are insecure out of the box.

Responses via API Resources. If the package has its own response formatting, prefer to bypass it and return JsonResource/ResourceCollection so your API shape stays under your control and is consistent across BREAD and non-BREAD endpoints.

Reuse the pattern. Once one controller works, generate the rest with php artisan make: or copy-and-adjust. Because the boilerplate is thin, the pattern is your real asset — document it in your repo (an app/Http/Controllers/Api/README.md or a template) so new endpoints look identical.

Testing pattern. Because BREAD is five verbs, test them as a table: browse (with and without filters, and with a relation search), read (found, 404, unauthorized), add (valid, invalid, unauthorized), edit (same), delete (found, soft-deleted). A single parameterized test per model catches regressions across the whole surface.

Gotchas and Tips

  • Recently revived, thinly maintained. v4.0.1 is the latest and signals a maintainer is active again, but it's a single-maintainer package with a small footprint. Pin the version (^4.0) in composer.json, read src/ before relying on implicit behavior, and don't assume a quick turnaround on issues. If you find yourself patching internals, fork it into app/ or a local path repo.
  • Don't assume 4.x ≈ the 2022 releases. The jump to 4.0 means old examples, StackOverflow answers, and the package's own older docs may not apply. Read the 4.0.0 changelog for breaking changes before copying any pre-2025 snippet, and re-verify class names and config keys in src/ rather than trusting memory.
  • Boilerplate ≠ dependency. The biggest mistake is treating it as a runtime library you're stuck with. It's designed to be a starting point; copy the controller into app/Http/Controllers/Api/, delete the require, and own it. That removes version-compatibility risk entirely.
  • Laravel version drift. Even on 4.x, check the illuminate/* constraints and PHP floor before installing. If they're capped below your Laravel version, Composer will refuse or you'll be running against untested internals.
  • Naming trap: BREAD's "Edit" and "Add" map to HTTP PUT/PATCH and POST; "Read" is GET /{id}; "Browse" is GET /. Don't accidentally collapse Browse and Read into one action — filtering logic doesn't belong on the single-record endpoint.
  • Relation display/search regressions. Because 4.0.1 changed searchField resolution for relations, snapshot-test your Browse responses after upgrading: a relation that previously returned an id or null may now return the display value (or vice versa if you had a manual override fighting the default). Same for filter behaviour on relation columns.
  • Route model binding and soft deletes. If your model uses SoftDeletes, GET /{id} on a trashed record 404s by default. Decide explicitly between withTrashed() for admin read vs. hard 404 for public, and test it.
  • Mass assignment. If the boilerplate does $model->fill($request->all()), replace it with $request->validated() immediately. This is the single highest-severity default in most scaffold packages.
  • Browse filter injection. Guard against users passing ?sort=id;drop table or arbitrary column names — validate sortable/filterable columns (including relation dotted paths) against a whitelist property on the controller.
  • Debugging: if routes 404 or the wrong middleware applies, php artisan route:list --path=api before touching controller code. If responses look wrong, dump the resolved controller instance in Route::getRoutes() to confirm you're hitting the package base rather than a Laravel default.
  • Extension points to prefer: config file (if published), the model/resource/searchable properties on the base controller, the relation display-field convention, and FormRequests. Avoid overriding deep base methods unless you've read them.
  • Migration off the package is trivial (copy the base controller into your app) — so the maintenance signal matters less here than for a runtime dependency. Price it as a one-day scaffold you'll own, not a library you'll rely on.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console