How to retrieve a term tree for a specific vocabulary given the machine name? Retrieving a term tree for a specific vocabulary  in Drupal 8 requires the vocabulary ID. I can find no function/method/service that will return the vocabulary entity given the machine name, in order to get the vocabulary ID.

How do I get a vocabulary ID from its machine name?
The vid field is the machine name for a vocabulary in Drupal 8.

You just need to pass the the string you have to TermStorage::loadTree, it doesn't need to be altered. For example:

$terms = \Drupal::entityManager()-&gt;getStorage('taxonomy_term')-&gt;loadTree("myname");