New!
Import instagram posts as nodes automatically with the instagram importer module for drupal 8 & 9.

 

May 28, 2019 in Drupal 8, Snippets

How do you get the base url of a drupal 8 website programmatically?

$host = \Drupal::request()->getSchemeAndHttpHost();

Or

$host = \Drupal::request()->getHost();