Creating a twig extension Drupal 8 allows you to use twig extensions easily. Here is an example of how. Tags Drupal 8 Twig