This question already has an answer here:

Is there a way (via settings.local.php maybe) of having a module enabled in production but not in dev.

I am thinking of PHP Shield in particular

marked as duplicate by Clive 8 Sep 24 '18 at 9:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.