Sometimes you want to import specific config files, out of your main config library. Here's a drush snippet which does exactly that.

When a drupal site has different domains for its language, difficulties can arise when developing locally. With the following snippet, you override your language settings, so prefixes are used instead of domains:

Add the following to your settings.php file:

$config['language.negotiation']['url']['source'] = 'prefix';


$date = strtotime($importObject->created_at); // which is a date format
$node->set('created', $date);
// $node->save(); etc


When saving nodes programmatically, you probably want to set the body to accept html. it is important to set the input format, so html is accepted.

From time to time it comes in quite handy to import configuration from other websites into yours. You site uuid is unique though, with the following snippet you get yours.

drush config-get "" uuid


A typical setup is one where you would redirect all non www and http requests to I prefer to keep my .htaccess file in version control also. With the following snippet, I get it the way I want it.

Easy snippet to get your current language:

// Get current language code
$language = \Drupal::languageManager()->getCurrentLanguage()->getId();


I started using an automated script for my drupal installation, which will generate an admin user. But, after installation I have to edit the password.
I like a good user interface for webmasters, so a clear menu path is necessary. For the admin toolbar dropdowns, I usually create subitems programmatically. 
While there are many ways to debug your errors, sometimes just seeing the full errors in your screen works best.