So if you are building in Drupal > 8, you can have settings in the database (coming from configuration yaml files). BUT, you can also hardcode these in your settings.php file. These will always override the settings in the database. 

On a development website you can create a development settings file:

  • From the sites folder copy example.settings.local.php and place it in /sites/default folder. So from \sites\example.settings.local.php to \sites\default
  • Rename the file to settings.local.php

Add the following:

// Don't use cache for development
$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
$settings['cache']['bins']['page'] = 'cache.backend.null';

// Show all error messages on the site
$config['system.logging']['error_level'] = 'all';

 // Disable Google Analytics from sending dev GA data (better to use TagManager though!)
$config['google_analytics.settings']['account'] = 'UA-XXXXXXXX-YY';

// Expiration of cached pages to 0
$config['system.performance']['cache']['page']['max_age'] = 0;

// Aggregate CSS files off
$config['system.performance']['css']['preprocess'] = 0;

// Aggregate JavaScript files off
$config['system.performance']['js']['preprocess'] = 0;

 Now enable the local settings file by uncommenting this line in settings.php:

 if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
   include $app_root . '/' . $site_path . '/settings.local.php';
 }

To the services.yml file, add:

parameters:
  http.response.debug_cacheability_headers: true
  twig.config:
    debug: true
    auto_reload: true
    cache: false
services:
  cache.backend.null:
    class: Drupal\Core\Cache\NullBackendFactory

Done! You now enabled some good local development settings.

 

 

Saved you some valuable time?

Received 100 so far from 4 kind contributors.