digitallyhappy/toggle-field-for-backpack
A toggle switch field for Backpack for Laravel admin panels, letting you edit boolean columns with a clean on/off switch instead of a checkbox. Drop it into your field definitions to make true/false settings faster and clearer to manage.
Package: digitallyhappy/toggle-field-for-backpack — a Backpack for Laravel CRUD field type that renders an on/off toggle widget in admin create/update forms. Scope is deliberately narrow: a field class plus a Blade view, no persistence, no migrations, no business logic.
Architecture fit: Excellent for its niche. Backpack field types are the framework's intended extension point, so this sits inside a documented seam rather than patching core. If our admin panels are Backpack-based, the package is architecturally "native" and carries almost no coupling beyond the Blade view markup and the Backpack field API.
Integration feasibility: High. Consumption is a single addField/->addField() call on a CRUD controller plus a Composer requirement. No service provider actions, config publishing, or database footprint is documented in the release.
Technical risk: The release itself is small — PR #3 (.gitignore) and PR #5 (README fix) are cosmetic. The substantive item is PR #8, "add support for Backpack v5," authored by tabacitu, the maintainer of Backpack itself. That is a strong provenance signal, but it also concentrates the risk:
2.0.0 → 2.0.1) implies backward compatibility with Backpack v4, but this must be verified in composer.json. If the constraint moved to ^5.0 only, existing v4 panels silently break on composer update.custom-control/custom-switch → form-check/form-switch). A view that renders in one framework can render invisibly or mis-styled in the other.Key questions:
composer.json declare backpack/crud: ^4.0|^5.0, or did 2.0.1 silently drop v4?2.0.0) we can pin if we are still on Backpack v4?Stack fit: Assumes a Laravel application running the Backpack for Laravel admin panel package. Value is only realized in that context; for non-Backpack Laravel apps, this is not a candidate. It complements rather than competes with our CRUD controllers — it is a presentation-layer field, so it does not affect data models, migrations, or APIs.
Migration path:
^2.0.1, verify the rendered toggle in a sandbox CRUD.composer update runs on untouched branches — pin the previous tag until the framework upgrade lands.2.0.0 and add a Renovate/Dependabot ignore rule on this package with a note referencing the Backpack v5 migration.Compatibility checks before merge:
backpack/crud and laravel/framework constraints in a throwaway branch and read the actual lock diff; do not infer from the version number.update view path and the name/attribute binding are the two places a field-type regression typically appears.Sequencing:
composer.json and the Blade diff (PR #8) — 30 minutes, no environment needed.Alternative considered: implement the toggle inline as a custom Blade partial in each panel. Rejected only if we have more than one or two Backpack panels — the package is small enough that vendoring the view is a legitimate fallback if maintenance stalls.
Maintenance: Negligible per-release cost — updates are single-line Composer edits. The real cost is the irregularity of releases: months of quiet followed by a patch that changes framework compatibility. Budget for a periodic (quarterly) manual review rather than assuming automated bumps are safe.
Support: No commercial support. Upstream assistance is community/GitHub issues routed through DigitallyHappy and, indirectly, the Backpack maintainers. Escalation path if the package is abandoned: fork the single Blade view and the field class into our own codebase — a few hours of work. Document that exit path now, while it is cheap.
Scaling: Irrelevant to application scaling. The package renders one form control; it adds no queries, no middleware, no cache surface. The only scaling dimension is organizational — every Backpack panel that adopts it inherits the same upgrade obligation, so standardize on one version estate-wide rather than letting panels drift.
Failure modes:
^5.0 constraint blocks Composer installs on Backpack v4 branches, failing builds rather than runtime — loud, and therefore benign.null vs false divergence; verify the migration default and the field's default state agree.Ramp-up: Near zero for any developer already writing Backpack CRUD controllers — the field is declarative and self-documenting. For developers new to Backpack, the learning cost belongs to Backpack, not to this package. Add one line to the admin-panel onboarding doc: which toggle field to use, and why we don't hand-roll partials.
Recommendation: Adopt, but pin explicitly and never let it float. The v5 support is welcome and the involvement of Backpack's own maintainer is reassuring; the patch-version framing of a framework-major change is the one thing that warrants a manual check before it enters any locked dependency set.
How can I help you explore Laravel packages today?