Menu Link Attributes is a great Drupal 8 module that allows you to add attributes to your menu links. Let's see how you can set the attributes programmatically.
As of writing this blog post, the Menu Token module for Drupal 8 is still in the alpha version and it might not work in all cases. That's why having an alternative solution is great. The alternative to using the Menu Token module for Drupal 8 is to use Menu link plugins.
Hierarchical Taxonomy Menu is a Drupal 8 module for creating menus from taxonomy terms.