drupal 8 load term by id

Drupal 8 Taxonomy Term Load

To access taxonomy terms in Drupal 8, you must include the Term class in your project.

use Drupal\taxonomy\Entity\Term;

In order to load the taxonomy, you must send the tid to the term: load function.

$term = Term::load($tid);

The getName function is used to get the name of the taxonomy loaded with the term: load function.