How to enable / disable a module in settings.local.php I'm using a settings.local.php for my local development environment. This is a Drupal 7 site.

I've seen a few references to this via google search, but none of the examples are working for me. I don't want to install a module to make this work if it is possible to accomplish the same result by adding a couple lines to the settings.local.php file.

I use this file all the time for a number of sites so I know it is being read properly. I've also used it to set variables (file_temporary_path, for example) and that works too. It is just enabling / disabling modules I'm having trouble with.

Any thoughts / suggestions?
I don't know if it is possible to enable / disable modules in settings.local.php but for downloading and enabling modules you can use drush, like so:

drush dl views
drush en views -y


For disabling the modules use:

drush dis views -y


Another method is to implement hook_update() in a custom module's module file to disable / enable modules.

/**
* Uninstall views module.
*/
function MODULENAME_update_7000(&amp;$sandbox) {
   module_disable(array('views'));
   drupal_uninstall_modules(array('views'), FALSE);
}


Of cource you can also use module_enable in the hook_update()

/**
* Install views module.
*/
function MODULENAME_update_7001(&amp;$sandbox) {
   module_enable(array('views'));
}


If you use hook_update then remember to do:

drush updb 


and 

drush cr


Hope this can help you.