php-debugbar icon indicating copy to clipboard operation
php-debugbar copied to clipboard

Development and production environments

Open NanneHuiges opened this issue 5 years ago • 1 comments

What is the preferred way to go about having a 'clean' production environment?

It might be so trivial that it's not mentioned and/or I'm just overlooking the hints in the docs, but I don't see much mention about environments. I would rather not have the debug-code running on production. The manual implies you use a normal require and not require-dev, so if I follow that you'd get the code online at least. THis is apart from the fact that you will have calls on several places?

You can probably easily not-render the bar in a production environment, but then, correct me if I'm wrong, your collectors are still collecting, using resources and possibly affect stuff. I suppose most of the collection will not be in a single place and therefore I'm not seeing a quick method to not-have that code running on a production environment. Only thing I could come up with is switching out your collectors with injection for some sort of dummy / empty collector that does nothing. But that feels hacky, and as it's not mentioned anywhere that's probably not the default method :)

Is there a best-practice somewhere to be found?

NanneHuiges avatar Jan 09 '20 08:01 NanneHuiges

I am looking for the same. There is no point in using this library if we can't disable it in production.

oscarlosan avatar Feb 16 '23 11:02 oscarlosan