skip to Main Content

Which is best way in laravel 9 app to check programatically if Debugbar(and its functions are available) installed in current installation ?

Thanks!

2

Answers


  1. try running $debugbarIsInstalled = class_exists(Debugbar::class)

    when return true means Debugbar is installed

    Login or Signup to reply.
  2. You can use the bound method to see if it’s bound to the Laravel container.

    if (app()->bound('debugbar')) {
        // Now you can safely use Debugbar methods without the need to import a class that may or may not exists.
        app('debugbar')->startMeasure('render','Time for rendering');
        app('debugbar')->stopMeasure('render')
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search