Michael Dryrynda has a post to his site sharing a method for using Laravel Telescope in specific environments. Telescope provides enhanced debugging functionality to Laravel applications for introspection into data about requests, jobs, queues and more.
Whilst its primary purpose is as a debugging tool in development, it is also a powerful asset in debugging your production environment. In order to get Telescope, however, I ran in to some stumbling points in my CI environment in GitLab.
To work around this, I set out to conditionally load Telescope. I stumbled upon this comment from Mohamed Said, which suggested loading the TelescopeServiceProvider in one of your application's service providers, but doing so was not enough.
He goes on to talk about the package auto-discover functionality Telescope uses to load its provider and how this, along with the
dont-discover configuration option in Composer's
extra section can be used to control its loading. He also includes the code needed to register the provider classes but only in the environments other than "build" and "testing".