Skip to content

fix: resolve Debugbar facade at runtime to support Barryvdh and Fruitcake implementations#118

Merged
mechelon merged 1 commit intobeyondcode:devfrom
NikhiltGhalme:fix/debugbar-facade-compat
Mar 20, 2026
Merged

fix: resolve Debugbar facade at runtime to support Barryvdh and Fruitcake implementations#118
mechelon merged 1 commit intobeyondcode:devfrom
NikhiltGhalme:fix/debugbar-facade-compat

Conversation

@NikhiltGhalme
Copy link
Copy Markdown
Contributor

Summary

The Debugbar output crashes with a fatal error when fruitcake/laravel-debugbar
is installed instead of barryvdh/laravel-debugbar, or when neither is present.

The existing code had a class_exists guard around the Fruitcake path but left
the Barryvdh fallback completely unguarded — if the Fruitcake check fails and
Barryvdh isn't installed either, the app 500s.

Changes

  • Replaced hardcoded facade use imports and branching if/else with a single
    resolveDebugbarFacade() method that checks all known facade FQCNs via
    class_exists() and returns the first match
  • All code paths are now guarded; boot() early-returns if no Debugbar is found
  • Supports: barryvdh/laravel-debugbar v3, v4+, and fruitcake/laravel-debugbar
  • Adding support for future forks = one string in the $candidates array
  • No breaking changes, no new dependencies, PHP 7.1+ compatible

Test plan

  • Install barryvdh/laravel-debugbar v3 — verify N+1 messages appear in Debugbar
  • Install barryvdh/laravel-debugbar v4+ — verify N+1 messages appear in Debugbar
  • Install fruitcake/laravel-debugbar — verify N+1 messages appear in Debugbar
  • Uninstall all Debugbar packages — verify no fatal error, output silently skipped
  • Install both Barryvdh and Fruitcake — verify Barryvdh takes precedence (first match)

mechelon added a commit that referenced this pull request Mar 20, 2026
Merge PR #118: replace hardcoded Debugbar facade imports with runtime
resolution supporting barryvdh v3/v4 and fruitcake implementations.
Fix testbench version range for Laravel 13 and normalize || separators
in composer.json.
@mechelon mechelon changed the base branch from master to dev March 20, 2026 15:23
@mechelon mechelon merged commit d18f1aa into beyondcode:dev Mar 20, 2026
10 of 15 checks passed
mechelon added a commit that referenced this pull request Mar 20, 2026
Normalize || separators in composer.json. Align workflow testbench
constraint with Laravel 13 (11.*).

Debugbar facade runtime resolution is handled separately in PR #118.

Made-with: Cursor
mechelon added a commit that referenced this pull request Mar 20, 2026
Normalize || separators in composer.json. Align workflow testbench
constraint with Laravel 13 (11.*).

Debugbar facade runtime resolution is handled separately in PR #118.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants